From 19cfa8d126a2ff54298150529e58e5e4f5495f09 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Wed, 9 Apr 2025 14:14:20 +0200 Subject: [bugfix] Fix a couple accessibility issues with `:focus` elements (#3979) * [bugfix/frontend] Fix accessibility/focus issues in settings + web ui * fix little error * tweaks --- web/source/settings/components/status.tsx | 64 ++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 14 deletions(-) (limited to 'web/source/settings/components/status.tsx') diff --git a/web/source/settings/components/status.tsx b/web/source/settings/components/status.tsx index 701a9f8b7..04c5933d5 100644 --- a/web/source/settings/components/status.tsx +++ b/web/source/settings/components/status.tsx @@ -17,7 +17,7 @@ along with this program. If not, see . */ -import React from "react"; +import React, { useRef } from "react"; import { useVerifyCredentialsQuery } from "../lib/query/login"; import { MediaAttachment, Status as StatusType } from "../lib/types/status"; import sanitize from "sanitize-html"; @@ -122,10 +122,26 @@ function StatusBody({ status }: { status: StatusType }) { content = sanitize(status.content); } + const detailsRef = useRef(null); + const detailsOnClick = () => { + detailsRef.current?.click(); + }; + + const summaryRef = useRef(null); + const summaryOnClick = () => { + summaryRef.current?.click(); + }; + return (
-
- +
+
e.key === "Enter" && summaryOnClick()} > Toggle content visibility @@ -183,23 +201,41 @@ function StatusMedia({ status }: { status: StatusType }) { } function StatusMediaEntry({ media }: { media: MediaAttachment }) { + const detailsRef = useRef(null); + const detailsOnClick = () => { + detailsRef.current?.click(); + }; + + const summaryRef = useRef(null); + const summaryOnClick = () => { + summaryRef.current?.click(); + }; + return (
- - - + + + e.key === "Enter" && summaryOnClick()} + > - {media.description}