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

Writing Flow: More reliable block clear via focus bubbling #5543

Merged
merged 1 commit into from
Mar 14, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Mar 10, 2018

This pull request seeks to improve reliability of the block click-to-clear behavior. The BlockSelectionClearer component in use works by checking whether the target of a click is the div rendered by the clearer. However, since there are often many block-level elements spanning full width between the selection clearer and where the click occurs (e.g. space adjacent the post title), clicking in these areas would not clear the block.

The changes proposed here instead assign the clearer as a (non-tabbable) focusable element which clears selection when the clearer div is the target of the focus. This way, even if the user clicks in a block-level element, if that element is not focusable, it will not be the target of the event.

Testing instructions:

  1. Create a new post
  2. Insert a block
  3. Click to the left or right of the post title
  4. Verify that the selected block is cleared

Edge cases to consider:

  • Firefox / Safari focus events on button clicks
  • Editing block settings in the sidebar

@aduth aduth added the [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... label Mar 10, 2018
@aduth aduth added this to the 2.4 milestone Mar 10, 2018
@aduth aduth merged commit 50cce90 into master Mar 14, 2018
@aduth aduth deleted the improve/block-selection-clearer branch March 14, 2018 00:20
@aduth
Copy link
Member Author

aduth commented Mar 14, 2018

May as well drop the Pen I put together demonstrating the effect:

https://codepen.io/aduth/pen/RMPgOE

Previous behavior effectively required clicking the "Red" directly, such that intermediate non-interactive elements could prevent the deselection. Current behavior is reflected in the Pen, allowing clicking through the non-interactive elements.

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...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant