mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-05 08:27:42 +00:00
🐛(frontend) fix focus restore for chevron menus
Ensure focus returns to camera chevron after effects panel closes.
This commit is contained in:
+1
@@ -152,6 +152,7 @@ export const VideoDeviceControl = ({
|
||||
</Button>
|
||||
{({ close }) => (
|
||||
<div
|
||||
data-attr="camera-menu-popover"
|
||||
className={css({
|
||||
maxWidth: '36rem',
|
||||
padding: '0.15rem',
|
||||
|
||||
@@ -25,6 +25,9 @@ export const Effects = () => {
|
||||
if (activeEl?.tagName === 'DIV') {
|
||||
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
|
||||
return activeEl
|
||||
},
|
||||
|
||||
@@ -30,6 +30,12 @@ export const useSidePanel = () => {
|
||||
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>> = {
|
||||
[PanelId.PARTICIPANTS]: 'participants',
|
||||
[PanelId.TOOLS]: 'tools',
|
||||
|
||||
@@ -138,7 +138,8 @@ export const Popover = ({
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!effectiveOpen || !focusOnOpen) return
|
||||
const wasOpen = prevOpenRef.current
|
||||
if (wasOpen || !effectiveOpen || !focusOnOpen) return
|
||||
const first = popoverContentRef.current?.querySelector<HTMLElement>(
|
||||
focusOnOpen.selector
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user