-
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
Fix "Select all" behavior in the editor #33167
Conversation
Size Change: +43 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good @adamziel. In the post editor things a lot better with this. testing this. However, I realized that pressing Cmd + A a third time selects all widget areas. |
This isn't a problem with cmd+a per se. Selecting all the widget areas using your mouse is a possible and valid behavior at the moment. I agree it doesn't a lot of sense for the user to do that, so maybe we should disallow it somehow @draganescu. Either way, this would be a new issue. |
…se the selection does not belong to the top-level children directly
packages/e2e-tests/specs/editor/various/multi-block-selection.test.js
Outdated
Show resolved
Hide resolved
packages/e2e-tests/specs/editor/various/multi-block-selection.test.js
Outdated
Show resolved
Hide resolved
packages/e2e-tests/specs/editor/various/multi-block-selection.test.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
* Make isEntirelySelected consider "deep" first and last children in case the selection does not belong to the top-level children directly * Rollback unit tests – jsdom does not support contentEditable jsdom/jsdom#1670 * Add an e2e test for multi-block selection * Adjust e2e tests * Add a separate test for gradual select-all from within the list block * Cosmetic adjustments to the e2e test * Update the snapshot
* Make isEntirelySelected consider "deep" first and last children in case the selection does not belong to the top-level children directly * Rollback unit tests – jsdom does not support contentEditable jsdom/jsdom#1670 * Add an e2e test for multi-block selection * Adjust e2e tests * Add a separate test for gradual select-all from within the list block * Cosmetic adjustments to the e2e test * Update the snapshot
* Make isEntirelySelected consider "deep" first and last children in case the selection does not belong to the top-level children directly * Rollback unit tests – jsdom does not support contentEditable jsdom/jsdom#1670 * Add an e2e test for multi-block selection * Adjust e2e tests * Add a separate test for gradual select-all from within the list block * Cosmetic adjustments to the e2e test * Update the snapshot
Description
When my cursor in in a block like "list" and I press cmd+a twice, the selection doesn't expand to all blocks anymore:
The issue is caused by
isEntirelySelected
only checking the selection container against block'sfirstChild
– which in this case isli
. The actual selection is pinned to the text note inside of thatli
. This PR explores resolving that using a deep comparison instead of a shallow comparison.The issue is reproducible across all editors (posts, pages, widgets etc.)
How has this been tested?
By interacting with the editor, unfortunately. I wanted to cover this with unit tests, but jsdom doesn't support contentEditable very well: jsdom/jsdom#1670
This means that the only way to test it is by adding some E2E tests. That's fine with me, but since that's cumbersome I'd rather get some comments on the approach first.
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).