I'm using Google Chrome Version 115.0.5790.170 (Official Build) (64-bit), on Linux:
Additional context
I solved the error locally, just by adding a ? before trying to clean the listeners of the useRovingTabIndex() ref, that may be null (and it is, indeed). My final useRovingTabIndex() hook looks like this:
return () => rootRef.current?.removeEventListener('keydown', handleKeyDown)
Instead of:
return () => rootRef.current.removeEventListener('keydown', handleKeyDown)
Didn't open a Pull Request because I don't know if it is fully safe to solve it this way
Thanks!
Describe the bug
The
<PagedTable />
component uses a<Dropdown />
component to display the size options, at the bottom of the table:When trying to close the dropdown (clicking outside of it or just by selecting an item), it panics with the following errors:
It seems that the reference used by
useRovingTabIndex()
is not there (is null) when theuseEffect()
cleanup function runs. This is the exact line where the error happens:To Reproduce
This is a copy of my
yarn.lock
(I'm using version 1.0.0-beta.55, the latest one):This is some code that can be used to reproduce the issue (just render it on the browser and open/close the referred dropdown):
I'm using Google Chrome Version 115.0.5790.170 (Official Build) (64-bit), on Linux:
Additional context
I solved the error locally, just by adding a
?
before trying to clean the listeners of theuseRovingTabIndex()
ref, that may be null (and it is, indeed). My finaluseRovingTabIndex()
hook looks like this:return () => rootRef.current?.removeEventListener('keydown', handleKeyDown)
Instead of:return () => rootRef.current.removeEventListener('keydown', handleKeyDown)
Didn't open a Pull Request because I don't know if it is fully safe to solve it this way Thanks!