mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
🩹(frontend) fix reaction toolbar refocusing first button on click
The toolbar's onFocus handler called focusManager.focusFirst() whenever focus arrived from outside the toolbar, which included clicks on reaction buttons. This caused focus (and the scroll viewport) to snap back to the first button on every click. Use :focus-visible to distinguish keyboard focus from pointer focus. Only redirect to the first button when focus arrives via keyboard, leaving click-induced focus untouched. Co-authored-by: Cyril <c.gromoff@gmail.com>
This commit is contained in:
committed by
aleb_the_flash
parent
e21da647a0
commit
4830ea5673
@@ -20,6 +20,7 @@ export const ReactionsKeyboardNavigation = ({
|
||||
const { close } = useReactionsToolbar()
|
||||
|
||||
const onFocus = (e: React.FocusEvent<HTMLDivElement>) => {
|
||||
if (!e.target.matches(':focus-visible')) return
|
||||
const comingFromOutside = !e.currentTarget.contains(e.relatedTarget)
|
||||
if (comingFromOutside) {
|
||||
focusManager?.focusFirst()
|
||||
|
||||
Reference in New Issue
Block a user