-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOM: Allow copying text from non-text input elements (#40192)
* DOM: Fix inputFieldHasUncollapsedSelection for non-text inputs The selection state of non-text input elements (e.g. `number`, but even `email`) is opaque to Gutenberg, per the HTML spec [1]. Unaware of this nuance, `inputFieldHasUncollapsedSelection` would incorrectly report that some non-text input element had no text selected when in fact it did. This caused the block editor to take over `copy` events to copy whole blocks, preventing the user from copying what they had actually selected inside the input element in question. The workaround in this commit is to always assume that there could be an uncollapsed selection in an active element if that element's selection state is opaque. [1]: https://html.spec.whatwg.org/multipage/input.html#do-not-apply * Add input type 'time' to isTextField's blacklist * Unit tests: update expectations for isTextField() * inputFieldHasUncollapsedSelection: Rewrite comments, default to true * documentHasSelection: Accept any input types ... as oppposed to just text inputs (isTextField) and number inputs (isNumberInput).
- Loading branch information
Showing
7 changed files
with
47 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters