From dfe6478fd755098361799fc95c98596ed18398a1 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Mon, 12 May 2025 12:38:06 -0400 Subject: [PATCH] [MM-63000][MM-63055][MM-63046] Various accessibility fixes around Drafts (#30924) * [MM-63000] Use CSS hover state instead of component state, add focus-within to ensure buttons are focusable * [MM-63046] Allow draft panel to be correctly focusable and navigable using correct roles * [MM-63046] Use `name` as `aria-label` for `Action` * update locator for scheduled drafts and fix failing playwright tests * fix lint * PR feedback * PR feedback --------- Co-authored-by: yasserfaraazkhan --- .../common/hooks/use_scroll_on_render.ts | 2 +- .../__snapshots__/action.test.tsx.snap | 1 + .../drafts/draft_actions/action.tsx | 1 + .../src/components/drafts/draft_row.tsx | 72 ++++++++++--------- .../panel/__snapshots__/panel.test.tsx.snap | 12 ++-- .../__snapshots__/panel_header.test.tsx.snap | 55 -------------- .../src/components/drafts/panel/panel.scss | 10 +++ .../src/components/drafts/panel/panel.tsx | 37 +++++----- .../components/drafts/panel/panel_header.scss | 11 +-- .../drafts/panel/panel_header.test.tsx | 17 ----- .../components/drafts/panel/panel_header.tsx | 7 +- webapp/channels/src/i18n/en.json | 2 + webapp/channels/src/utils/utils.tsx | 1 + 13 files changed, 84 insertions(+), 144 deletions(-) diff --git a/webapp/channels/src/components/common/hooks/use_scroll_on_render.ts b/webapp/channels/src/components/common/hooks/use_scroll_on_render.ts index 3109de4b20..84dc9bc1ff 100644 --- a/webapp/channels/src/components/common/hooks/use_scroll_on_render.ts +++ b/webapp/channels/src/components/common/hooks/use_scroll_on_render.ts @@ -6,7 +6,7 @@ import React from 'react'; // useScrollOnRender hook is used to scroll to the element when it is rendered // Attach the returned ref to the element you want to scroll to. export function useScrollOnRender() { - const ref = React.useRef(null); + const ref = React.useRef(null); React.useEffect(() => { if (ref.current) { diff --git a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/action.test.tsx.snap b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/action.test.tsx.snap index 3d33920ffb..b842937939 100644 --- a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/action.test.tsx.snap +++ b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/action.test.tsx.snap @@ -8,6 +8,7 @@ exports[`components/drafts/draft_actions/action should match snapshot 1`] = ` title="" >