🐛(frontend) fix focus restore for chevron menus

Ensure focus returns to camera chevron after effects panel closes.
This commit is contained in:
Cyril
2026-02-05 10:31:24 +01:00
parent c803bd9170
commit ed97f09aad
4 changed files with 12 additions and 1 deletions
@@ -152,6 +152,7 @@ export const VideoDeviceControl = ({
</Button> </Button>
{({ close }) => ( {({ close }) => (
<div <div
data-attr="camera-menu-popover"
className={css({ className={css({
maxWidth: '36rem', maxWidth: '36rem',
padding: '0.15rem', padding: '0.15rem',
@@ -25,6 +25,9 @@ export const Effects = () => {
if (activeEl?.tagName === 'DIV') { if (activeEl?.tagName === 'DIV') {
return getTrigger('options') ?? activeEl return getTrigger('options') ?? activeEl
} }
if (activeEl?.closest('[data-attr="camera-menu-popover"]')) {
return getTrigger('cameraMenu') ?? activeEl
}
// For direct button clicks, use the active element as is // For direct button clicks, use the active element as is
return activeEl return activeEl
}, },
@@ -30,6 +30,12 @@ export const useSidePanel = () => {
return layoutStore.sidePanelTriggers.options ?? activeEl return layoutStore.sidePanelTriggers.options ?? activeEl
} }
} }
if (
panelId === PanelId.EFFECTS &&
activeEl?.closest('[data-attr="camera-menu-popover"]')
) {
return layoutStore.sidePanelTriggers.cameraMenu ?? activeEl
}
const triggerKeyByPanel: Partial<Record<PanelId, SidePanelTriggerKey>> = { const triggerKeyByPanel: Partial<Record<PanelId, SidePanelTriggerKey>> = {
[PanelId.PARTICIPANTS]: 'participants', [PanelId.PARTICIPANTS]: 'participants',
[PanelId.TOOLS]: 'tools', [PanelId.TOOLS]: 'tools',
+2 -1
View File
@@ -138,7 +138,8 @@ export const Popover = ({
} }
useEffect(() => { useEffect(() => {
if (!effectiveOpen || !focusOnOpen) return const wasOpen = prevOpenRef.current
if (wasOpen || !effectiveOpen || !focusOnOpen) return
const first = popoverContentRef.current?.querySelector<HTMLElement>( const first = popoverContentRef.current?.querySelector<HTMLElement>(
focusOnOpen.selector focusOnOpen.selector
) )