From 19d83a0812e954cbfd640ca2a37b85bff1a4365b Mon Sep 17 00:00:00 2001 From: R Midhun Suresh Date: Wed, 17 Jul 2024 18:37:12 +0530 Subject: [PATCH] Pass focusVisible option to focus call --- src/accessibility/LandmarkNavigation.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/accessibility/LandmarkNavigation.ts b/src/accessibility/LandmarkNavigation.ts index f8cb34c646b8..955fa1da22a1 100644 --- a/src/accessibility/LandmarkNavigation.ts +++ b/src/accessibility/LandmarkNavigation.ts @@ -18,6 +18,12 @@ import { TimelineRenderingType } from "../contexts/RoomContext"; import { Action } from "../dispatcher/actions"; import defaultDispatcher from "../dispatcher/dispatcher"; +/** + * In future, browsers will support focusVisible option. + * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#focusvisible + */ +type ExperimentalFocusAction = FocusOptions & { focusVisible: true }; + export const enum Landmark { // This is the space/home button in the left panel. ACTIVE_SPACE_BUTTON, @@ -67,7 +73,7 @@ export class LandmarkNavigation { landmark = LandmarkNavigation.getLandmark(landmark, backwards); element = landmarkToDomElementMap[landmark](); } - element?.focus(); + element?.focus({ focusVisible: true } as ExperimentalFocusAction); } }