patternfly-react icon indicating copy to clipboard operation
patternfly-react copied to clipboard

fix(Select/Dropdown): updated autofocus to false by default in v6

Open thatblindgeye opened this issue 1 year ago • 1 comments

What: Towards #10393

We have a followup to investigate improving the focus logic/styling overall post-v6

Additional issues:

thatblindgeye avatar Oct 16 '24 19:10 thatblindgeye

Preview: https://patternfly-react-pr-11115.surge.sh

A11y report: https://patternfly-react-pr-11115-a11y.surge.sh

patternfly-build avatar Oct 16 '24 19:10 patternfly-build

As as addon to Adam's comment, we could also remove Tab from being a default toggle key temporarily. That way a user could tab into the menu while its open to get to the keyboard handling.

kmcfaul avatar Oct 22 '24 18:10 kmcfaul

@adamviktora I think I did something similar locally at some point when tinkering around, though it was done as part of the base Menu/Select/Dropdown logic (rather than in each example code). May depend whether we would want to at least show a way consumers could handle focus management themselves in the mean time (since if a consumer opts to not autofocus for a non-typeahead, they'll have to do handle it themselves), or if we want to wait and see what potentially refactoring the logic internally may look like.

@kmcfaul one issue with that may be that it depends where the menu is appended; with the document body appending then Tab may not go into the menu itself

thatblindgeye avatar Oct 22 '24 18:10 thatblindgeye

@thatblindgeye I prefer doing it as part of the base Menu logic. Consumers will probably expect it to be an out-of-the-box behaviour, so it will be better if it is part of the base component.

if we want to wait and see what potentially refactoring the logic internally may look like

I prefer this, but it depends how long will it be, so we don't ship a half-working version now. But if the followup to fix it is a high priority, then I am absolutely ok with it.

adamviktora avatar Oct 23 '24 12:10 adamviktora

The current plan is:

  1. Merge this PR as-is
  2. Create a followup for v6 to add logic internal to Select, Dropdown, and MenuContainer to handle up/down arrow keys focusing items with ability to customize this
  3. Re-evaluate whether https://github.com/patternfly/patternfly-react/issues/11025 is still applicable

thatblindgeye avatar Oct 23 '24 15:10 thatblindgeye

Your changes have been released in:

Thanks for your contribution! :tada:

patternfly-build avatar Oct 23 '24 15:10 patternfly-build