mirror of https://github.com/vector-im/riot-web
Tweak roving tab index focus behaviour (#7254)
parent
0afe141266
commit
68604e3505
|
@ -130,8 +130,11 @@ export const reducer = (state: IState, action: IAction) => {
|
||||||
state.activeRef = findSiblingElement(state.refs, oldIndex)
|
state.activeRef = findSiblingElement(state.refs, oldIndex)
|
||||||
|| findSiblingElement(state.refs, oldIndex, true);
|
|| findSiblingElement(state.refs, oldIndex, true);
|
||||||
}
|
}
|
||||||
|
if (document.activeElement === document.body) {
|
||||||
|
// if the focus got reverted to the body then the user was likely focused on the unmounted element
|
||||||
state.activeRef?.current?.focus();
|
state.activeRef?.current?.focus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// update the refs list
|
// update the refs list
|
||||||
return { ...state };
|
return { ...state };
|
||||||
|
|
Loading…
Reference in New Issue