Forum Discussion
CharlesY
Aug 02, 2020Copper Contributor
inputType property not correctly implemented.
The inputType property of <input> is not handled correctly on Edge running on MacOS. MacOS provide auto-correction tools which may alter text typed into <input>s. For example, if you type two spaces after a word, the first space will generally be replaced by a period (full stop) due to the 'Add full stop with double-space' option under Keyboard/Text settings in the OS.
When the browser fires the 'input' event, it should set the inputType attribute of the event to 'InsertReplacementText' to indicate that the OS is replacing text as the result of spell-checking or auto-correction. Unfortunately, Edge on the MacOS does not handle this correctly. It always sets the value to 'InsertText' which should only be used to indicate the entry of plain text (i.e., the text that the user actually typed).
This failure to adhere to the standards means that the only way to switch off automatic text replacement is at the OS level, affecting every application on the Mac. If the input event was correctly formed it would be trivial to listen for input events with the 'InsertReplacementText' inputType and discard them, which neatly 'switches off' text replacement in the web page.
Interestingly, this issue is not observed under Chrome on the MacOS suggesting that there is a difference in the current implementation between Edge and Chrome - probably that Chrome ignores auto-correction messages from the OS.
Our application supports barcode scanning, but when we scan into the application under Edge, the keyboard input from the barcode scanner is not entered correctly due to automatic character replacement. Asking end users to reconfigure their entire OS is not acceptable is our case, so currently we have had to abandon support for Edge on the MacOS.
To reproduce the issue, go to https://w3c.github.io/uievents/tools/key-event-viewer.html in Edge on MacOS. This page contains an <input> and displays events. Type a few characters followed by two spaces. The first space will be automatically replaced by a period (full stop). Inspect the input and beforeinput events. The inputType is set to 'insertText'. Now repeat the above is Safari and observe the correct use of 'InsertReplacementText'. There is no point in repeating this in Chrome because Chrome does not support text replacement.
No RepliesBe the first to reply