inputType property not correctly implemented.

%3CLINGO-SUB%20id%3D%22lingo-sub-1561780%22%20slang%3D%22en-US%22%3EinputType%20property%20not%20correctly%20implemented.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1561780%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20inputType%20property%20of%20%3CINPUT%20%2F%3E%20is%20not%20handled%20correctly%20on%20Edge%20running%20on%20MacOS.%20MacOS%20provide%20auto-correction%20tools%20which%20may%20alter%20text%20typed%20into%20%3CINPUT%20%2F%3Es.%20For%20example%2C%20if%20you%20type%20two%20spaces%20after%20a%20word%2C%20the%20first%20space%20will%20generally%20be%20replaced%20by%20a%20period%20(full%20stop)%20due%20to%20the%20'Add%20full%20stop%20with%20double-space'%20option%20under%20Keyboard%2FText%20settings%20in%20the%20OS.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20the%20browser%20fires%20the%20'input'%20event%2C%20it%20should%20set%20the%20inputType%20attribute%20of%20the%20event%20to%20'InsertReplacementText'%20to%20indicate%20that%20the%20OS%20is%20replacing%20text%20as%20the%20result%20of%20spell-checking%20or%20auto-correction.%20Unfortunately%2C%20Edge%20on%20the%20MacOS%20does%20not%20handle%20this%20correctly.%20It%20always%20sets%20the%20value%20to%20'InsertText'%20which%20should%20only%20be%20used%20to%20indicate%20the%20entry%20of%20plain%20text%20(i.e.%2C%20the%20text%20that%20the%20user%20actually%20typed).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20failure%20to%20adhere%20to%20the%20standards%20means%20that%20the%20only%20way%20to%20switch%20off%20automatic%20text%20replacement%20is%20at%20the%20OS%20level%2C%20affecting%20every%20application%20on%20the%20Mac.%20If%20the%20input%20event%20was%20correctly%20formed%20it%20would%20be%20trivial%20to%20listen%20for%20input%20events%20with%20the%20'InsertReplacementText'%20inputType%20and%20discard%20them%2C%20which%20neatly%20'switches%20off'%20text%20replacement%20in%20the%20web%20page.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInterestingly%2C%20this%20issue%20is%20not%20observed%20under%20Chrome%20on%20the%20MacOS%20suggesting%20that%20there%20is%20a%20difference%20in%20the%20current%20implementation%20between%20Edge%20and%20Chrome%20-%20probably%20that%20Chrome%20ignores%20auto-correction%20messages%20from%20the%20OS.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOur%20application%20supports%20barcode%20scanning%2C%20but%20when%20we%20scan%20into%20the%20application%20under%20Edge%2C%20the%20keyboard%20input%20from%20the%20barcode%20scanner%20is%20not%20entered%20correctly%20due%20to%20automatic%20character%20replacement.%20Asking%20end%20users%20to%20reconfigure%20their%20entire%20OS%20is%20not%20acceptable%20is%20our%20case%2C%20so%20currently%20we%20have%20had%20to%20abandon%20support%20for%20Edge%20on%20the%20MacOS.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20reproduce%20the%20issue%2C%20go%20to%20%3CA%20href%3D%22https%3A%2F%2Fw3c.github.io%2Fuievents%2Ftools%2Fkey-event-viewer.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fw3c.github.io%2Fuievents%2Ftools%2Fkey-event-viewer.html%3C%2FA%3E%20in%20Edge%20on%20MacOS.%20This%20page%20contains%20an%20%3CINPUT%20%2F%3E%20and%20displays%20events.%20Type%20a%20few%20characters%20followed%20by%20two%20spaces.%20The%20first%20space%20will%20be%20automatically%20replaced%20by%20a%20period%20(full%20stop).%20Inspect%20the%20input%20and%20beforeinput%20events.%20The%20inputType%20is%20set%20to%20'insertText'.%20Now%20repeat%20the%20above%20is%20Safari%20and%20observe%20the%20correct%20use%20of%20'InsertReplacementText'.%20There%20is%20no%20point%20in%20repeating%20this%20in%20Chrome%20because%20Chrome%20does%20not%20support%20text%20replacement.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Senior Member

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.

0 Replies