cordova-plugin-wkwebview-engine icon indicating copy to clipboard operation
cordova-plugin-wkwebview-engine copied to clipboard

Calling focus() on a read only input shows unwanted input accessory view bar

Open 5r1m opened this issue 6 years ago • 0 comments

Bug Report

Problem

When calling focus() on a read only input element in its touchstart handler, an unwanted inputAccessoryView(prev, next and done bar) is shown at bottom of the screen. This happens only in wkwebview and works fine with UIWebview.

What is expected to happen?

inputAccessoryView or native keyboard should not be shown on calling element.focus() on a read only input element

What does actually happen?

inputAccessoryView is shown on focusing on an read only input element

inputAccessoryView_2

Command or Code

Steps to reproduce the issue:

Create a basic cordova ios app using the below link: https://cordova.apache.org/docs/en/latest/guide/cli/

Install wkwebview as described in "Installation" section in the below link: https://github.com/apache/cordova-plugin-wkwebview-engine

Add a readonly input field in the body: <input id="tstInput" type="text" value = "text here" readonly/>

Add touch start event handler for readonly input inside onDeviceReady function:

function tstInput_onTouchStart(event) {
        event.preventDefault();
        var input = event.target;
        input.focus();
        input.select();
      }
      
      document.getElementById('tstInput').addEventListener('touchstart', tstInput_onTouchStart, false);

Environment, Platform, Device

iPhone

Version information

iOS: 12.1.1 Cordova: 8.1.2

Checklist

  • [x] I searched for existing GitHub issues
  • [ ] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

5r1m avatar Jun 20 '19 04:06 5r1m