[wp-trac] [WordPress Trac] #51577: DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement'
WordPress Trac
noreply at wordpress.org
Tue Oct 20 16:18:12 UTC 2020
#51577: DOMException: Failed to set the 'selectionStart' property on
'HTMLInputElement'
--------------------------+-----------------------------
Reporter: bradmarshall | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.5.1
Severity: blocker | Keywords:
Focuses: |
--------------------------+-----------------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51577>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list