Tree Grid: Fix keyboard navigation for expand/collapse table rows in Firefox#37983
Conversation
|
Size Change: +422 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
Looks like this is the cause of the issue. Thanks for fixing it @alexstine. What do you think about restoring the |
|
@talldan useCallback() is also a problem. If I use useCallback(), I get really strange behavior with keyboard keys not being detected correctly. E.g. if I collapse the column and then try to expand again, it returns false super early. It's like useCallback() effects the use of event.keyCode being reliable and returning the currently pressed key. I thought the whole point of useCallback() was only to execute a function once after mounting, not to execute time and time again with keyboard interaction. Did I not understand the docs here or is there something else possibly going on? I console.log most of the code and it is clear, using the useCallback() function messes with keyboard key detection. The ariaExpanded issue was a quick find for me because I quickly realized logging after the conditional statements was returning nothing. Checking MDN gave me my answer. Thanks. |
|
@talldan I saw your note about the missing deps from useCallback(). Sure enough, everything is working now. |
There was a problem hiding this comment.
That fixes it, thanks @alexstine!
I'll add the 'Backport to WP Minor Release' label so that this makes its way into WordPress 5.9.1.
…7983) * Fix keyboard navigation for Tree Grid. * Add useCallback with list of deps.
Description
Fixes #37972
How has this been tested?
Tested in Firefox with NVDA screen reader on Windows 10.
Screenshots
Types of changes
Bug fix
Checklist:
*.native.jsfiles for terms that need renaming or removal).