WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Nav sidebar: improve focus management on toggle of sidebar #39801

Open getdave opened 2 years ago

getdave commented 2 years ago

I'd expect focus to be transferred to the sidebar when that button is clicked, as well as from the "Navigation Menus" button in the header

See https://github.com/WordPress/gutenberg/pull/39290/#issuecomment-1078648412.

As suggested there let's improve the focus management to transfer to/from the sidebar.

getdave commented 2 years ago

Ok I had a look at this. This is a problem for all the secondary sidebars because it isn't handled in the @wordpress/interface package. I believe the reason for this is that it's very difficult to have a one-size-fits-all for choosing which element to focus.

I'll keep working on this.

alexstine commented 2 years ago

@getdave How does it work currently for block settings sidebar? E.g. using Tab key out of a block will focus block settings sidebar.

getdave commented 2 years ago

It's using some hooks to handle going to new focus and back to old one. The complexity in this case is that this sidebar makes use of ComplementaryArea from @wordpress/interface which is deeply nested and uses a lot of Slot/Fill. This makes auto managing focus quite complex.

alexstine commented 2 years ago

@getdave Probably need to use something more flexible. I've faced issues with that myself in another PR.

alexstine commented 2 years ago

@getdave Can I help in any way? We've got to land this one before this goes out in 6.0. Labeling issues we can live with, focus management is a must.

getdave commented 2 years ago

@getdave Can I help in any way? We've got to land this one before this goes out in 6.0. Labeling issues we can live with, focus management is a must.

@alexstine I'm painfully aware of this. I've been reaching out looking for additional support as I've been swamped with tasks. I'll circle back to this tomorrow to see if I can find a simple fix with a view to providing something more comprehensive in a future release.

scruffian commented 2 years ago

Given that this doesn't happen for the other sidebars, is it a blocker for 6.0?

alexstine commented 2 years ago

@scruffian

Given that this doesn't happen for the other sidebars, is it a blocker for 6.0?

Absolutely. There is no way this should have happened for other sidebars.

github-actions[bot] commented 2 years ago

Hi, This issue has gone 180 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

getdave commented 2 years ago

This is still valid. Note the sidebar is still experimental so it won't end up in WP 6.1.