DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement' #26983
Labels
[Feature] Blocks
Overall functionality of blocks
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Status] Stale
Gives the original author opportunity to update before closing. Can be reopened as needed.
[Type] Bug
An existing feature does not function as intended
Reported by bradmarshall:
https://core.trac.wordpress.org/ticket/51577
Actual behaviour:
dom.js is attempting to access the
selectionStart
property on input[type=email] in Gutenberg running WordPress 5.5.1, which triggers a DOM exception in the WP admin which breaks the gutenberg block containing the input.Why?
This MDN article (https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange) states that only certain types of inputs and textareas impmlement selectionStart / selectionEnd but it looks as though numerous functions throughout the file attempt to use selectionStart/selectionEnd without first qualifying the type of input in question. Therefore, any input[type=email] elements in a block are crashing out.
Expected behaviour:
dom.js should not attempt to use selectionStart/selectionEnd on just any type of input - it should instead first check to make sure it's one of type=text, search, URL, tel or password. Gutenberg blocks containing input types other than these should not crash.
Version:
WordPress 5.5.1
The text was updated successfully, but these errors were encountered: