-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Safari: Shift+click can't select across text blocks #44755
Comments
I explored this issue some. I did not identify the bug origin or a solution, but will capture what I did discover for posterity. Contributors more familiar with the code may already be aware of some of this information, but I'll share it nonetheless. When moving the cursor into the second block (i.e. Shift + Click), both Chrome and Firefox trigger at least one invocation of Contrastingly, in this same context, Safari only ever triggers The relevant gutenberg/packages/rich-text/src/component/use-input-and-selection.js Lines 314 to 317 in cb8ed51
I have not yet identified why Safari does not trigger an event with different Removing myself as an assignee as I likely will not have time focus on this in the near future. |
As an added data point: this works in both Firefox and Chrome, but not for the same reasons. In Chrome, the active element is the iframe's body element, as you might expect, and so selection is adjusted according to the rules in In Firefox, the active element is the second paragraph (i.e. the one into which we shift-clicked), which throws off the expectation that the current element is contained by the active one, thus the selection is not updated in that section of the handler, but somewhere else. |
I just run into this problem as I was testing the editor in Safari. I am going to add my own testing video: Screen.Capture.on.2023-07-27.at.18-17-57.mp4 |
Confirmed. |
The root problem is Safari refusing to select if there's a tabindex set. It's strange that selecting otherwise works, it only happens with Shift + Click. https://codepen.io/iseulde/pen/GRwLVyx |
Description
Clicking while pressing the Shift key is a convenient way to create a selection between two points. Since the introduction of partial multi-selection in #38892, users can expect to use this method of selection across blocks, just as they would in a word processor. It doesn't work in Safari, though.
Step-by-step reproduction instructions
Expected: a partial selection across the two paragraphs
Observed: a collapsed selection in the second paragraph
Screenshots, screen recording, code snippet
A comparison between Firefox (expected behaviour) and Safari (unexpected). In both browsers, shift-clicking inside the same paragraph works (unsurprisingly), but shift-clicking across blocks just moves the collapsed selection when using Safari.
Screen.Recording.2022-10-06.at.18.04.14.mov
Environment info
Gutenberg trunk, etc.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: