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

Focus lost when multi-block selection turn into single-block selection #3999

Closed
2 tasks
mcsf opened this issue Dec 14, 2017 · 2 comments
Closed
2 tasks

Focus lost when multi-block selection turn into single-block selection #3999

mcsf opened this issue Dec 14, 2017 · 2 comments
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).

Comments

@mcsf
Copy link
Contributor

mcsf commented Dec 14, 2017

Part of umbrella issue #2990.

Issue Overview

Suppose a user has a multi-selection of blocks A, B and C, having started selection at block A. When switching selection back to only encompass block A, focus/selection are seemingly lost. This is most evident and painful when performing keyboard-based navigation and selection, as also voiced in @ephox-mogran's comment #3297 (comment), but is also noticeable when using the pointer, as noted in @iseulde's comment #2990 (comment)

Steps to Reproduce (for bugs)

  1. Open a post that contains three Paragraph blocks, each of which with content.
  2. Place the caret in the middle of the first block.
  3. Hold Shift until the end of the sequence.
  4. Start single-block selection by pressing the keyboard's down arrow ().
  5. Keep pressing until the second block is reached, thus initiating multi-block selection.
  6. Press once more to reach the third block.
  7. Press twice to switch selection back to the first block only.

Expected Behavior

  • Expected to find the caret where selection had been started within the first block, and expected to be able to move it with the arrow keys and continue editing.
  • Depending on initial caret position, expected to find some text within the first block to be selected.

Current Behavior

  • The caret disappears and seemingly can't be recovered with the arrow keys only.
  • Visually, it appears the block itself isn't selected (cf. inspector).
  • If dependent on the keyboard, I have to press Tab to outline the block, after which the arrow keys work.
  • Depending on initial caret position, some text within the block appears to be selected (highlighted), but it is unreachable.

Possible Solution

Screenshots / Video

gutenberg-select-multi-to-single

Related Issues and/or PRs

Todos

  • Tests
  • Documentation
@mcsf mcsf added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... labels Dec 14, 2017
@ephox-mogran
Copy link
Contributor

@mcsf, I've got a POC PR (#3584 ) which explores a different way of handling this. Essentially, it allows multi-block selections of only one block, and separates focus from selection. I think it's a reasonable way to keep focus in a sensible location, but I'd like some feedback.

The code itself is not important. It's fairly hacky.

@mcsf
Copy link
Contributor Author

mcsf commented Jul 9, 2018

Testing in 3.2, can no longer repro.

@mcsf mcsf closed this as completed Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

No branches or pull requests

2 participants