-
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
Blocks: Avoid autofocus behavior for blocks without focusable elements #5110
Conversation
…s (don't autofocus the parent)
I don't know about others, but now I believe that some of the reproduced instances were false-positives: if the user moves the cursor ever so briefly (imperceptibly so) between clicking and releasing the click, the whole block is selected. Happens both in base and branch. |
Good find @mcsf this hints that the remaining issue is related to multi-selection :) |
:) That said, there are some occurrences that this PR does fix, so let's merge it! Steps:
|
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 fixed the problem in my tests.
@@ -218,7 +218,8 @@ export class BlockListBlock extends Component { | |||
} | |||
|
|||
// Find all tabbables within node. | |||
const tabbables = focus.tabbable.find( this.node ); | |||
const tabbables = focus.tabbable.find( this.node ) | |||
.filter( ( node ) => node !== this.node ); |
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.
I'm not sure when this could be the case? Following the logic, find
will call querySelectorAll
, which shouldn't include the source node.
Avoid auto-focusing blocks without any tabbable element.