Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement' #26983

Closed
sabernhardt opened this issue Nov 15, 2020 · 3 comments
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

Comments

@sabernhardt
Copy link
Contributor

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

@talldan talldan linked a pull request Nov 16, 2020 that will close this issue
6 tasks
@talldan talldan added [a11y] Keyboard & Focus [Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended labels Nov 16, 2020
@talldan
Copy link
Contributor

talldan commented Nov 16, 2020

#26074 should fix this if we can resolve the feedback in the PR.

@talldan talldan linked a pull request Nov 20, 2020 that will close this issue
6 tasks
@talldan talldan linked a pull request Feb 2, 2021 that will close this issue
2 tasks
@kathrynwp kathrynwp added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Aug 9, 2022
@kathrynwp
Copy link

Hi @talldan if there's any way to get that PR reviewed/merged, it would be great to be able to close this one out. Thanks!

@ndiego
Copy link
Member

ndiego commented May 23, 2023

This issue was reviewed in today's Editor Bug Scrub. Upon investigation, it appears to have been resolved as part of #40192 based on this comment. Therefore, I am going to close this issue but feel free to reopen it if issues persist. Thanks!

@ndiego ndiego closed this as completed May 23, 2023
@priethor priethor added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
5 participants