Skip to content

Conversation

gribnoysup
Copy link
Collaborator

@gribnoysup gribnoysup commented Mar 25, 2022

This patch fixes an issue where interacting with any item in the virtual grid would always automatically move focus to the first element in the grid. This has no behavioral effect when interacting with the grid only with a keyboard or with a mouse, but was causing a visual issue that @Anemy spotted here and a weird keyboard behavior if you would switch from using mouse to keyboard. This new focus / blur handling logic makes sure that the focus is always in sync with whatever and however user is interacting with the items in the list.

@gribnoysup gribnoysup force-pushed the virtual-grid-better-focus branch from e73c252 to 8271595 Compare March 25, 2022 15:17
@gribnoysup gribnoysup force-pushed the virtual-grid-better-focus branch from 8271595 to d4e97a7 Compare March 25, 2022 15:24
Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! nice. Eventually do we want the focus to return to the last focused element when focus is lost and regained instead of the first element? Example of how it returns to first:

should.it.refocus.last.focus.mp4

@gribnoysup
Copy link
Collaborator Author

It is supported by the hook, so it's only one param passed to the hook away 😄 Both are described in the WCAG as allowed behaviors IIRC, I was just not sure what's the best match here

@gribnoysup gribnoysup force-pushed the virtual-grid-better-focus branch from 165de0b to 9d7f903 Compare March 28, 2022 08:24
@gribnoysup gribnoysup merged commit 19f2535 into main Mar 28, 2022
@gribnoysup gribnoysup deleted the virtual-grid-better-focus branch March 28, 2022 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants