Previously RovingTabIndexProvider held an array of refs in state. Every time a new ref was added to the array, the entire array was sorted. With strict mode, refs/reducers/components/effects are all run twice. This lead to some refs being unset (i.e ref.current = null) just before sorting began.
This PR fixes the issue by refactoring the code so that we keep an array of DOM elements instead of refs.
Fixes https://github.com/element-hq/element-web/issues/28404
Previously
RovingTabIndexProvider
held an array of refs in state. Every time a new ref was added to the array, the entire array was sorted. With strict mode, refs/reducers/components/effects are all run twice. This lead to some refs being unset (i.e ref.current = null) just before sorting began.This PR fixes the issue by refactoring the code so that we keep an array of DOM elements instead of refs.