-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Prevent a block and console error for input[type=email]
#26074
Closed
kienstra
wants to merge
8
commits into
WordPress:trunk
from
kienstra:fix/input-selection-start-error
Closed
Prevent a block and console error for input[type=email]
#26074
kienstra
wants to merge
8
commits into
WordPress:trunk
from
kienstra:fix/input-selection-start-error
Commits on Oct 13, 2020
-
Prevent a console and block error on input[type=email]
When this is at the top of a block, on first addding the block, there is a block and JS error: DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement': The input element's type ('email') does not support selection. at placeCaretAtHorizontalEdge (https://path/to/wp-content/plugins/gutenberg/build/dom/index.js?ver=cbf62a0bae5cfd2eeff038ee115edc0a:390:32) This looks to be because HTMLInputElement only has a selectionStart property for 'text/number-containing or elements' https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement
Configuration menu - View commit details
-
Copy full SHA for 659a851 - Browse repository at this point
Copy the full SHA 659a851View commit details -
It looks like document.createElement( 'input' ) doesn't create an object with .selectionStart. So manually add one, although it's not ideal.
Configuration menu - View commit details
-
Copy full SHA for 03e6006 - Browse repository at this point
Copy the full SHA 03e6006View commit details -
Configuration menu - View commit details
-
Copy full SHA for a1fd12b - Browse repository at this point
Copy the full SHA a1fd12bView commit details -
Add a test to assert that the caret isn't moved
If there's no selectionStart, it should not be moved.
Configuration menu - View commit details
-
Copy full SHA for 942c68c - Browse repository at this point
Copy the full SHA 942c68cView commit details -
PHPUnit tests failed, though this PR doesn't touch a PHP file: https://github.com/WordPress/gutenberg/runs/1249706078
Configuration menu - View commit details
-
Copy full SHA for 920c5f2 - Browse repository at this point
Copy the full SHA 920c5f2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 82c6556 - Browse repository at this point
Copy the full SHA 82c6556View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6170052 - Browse repository at this point
Copy the full SHA 6170052View commit details
Commits on Oct 14, 2020
-
Configuration menu - View commit details
-
Copy full SHA for a431449 - Browse repository at this point
Copy the full SHA a431449View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.