From 9c1074061e0f7231091e9e8bfe76752fd8a00f7b Mon Sep 17 00:00:00 2001 From: Prozilla Date: Mon, 7 Aug 2023 13:40:55 +0200 Subject: [PATCH] Improved accessibility by adding focus styles --- .../file-explorer/FileExplorer.jsx | 23 ++++++++++--------- .../file-explorer/FileExplorer.module.css | 7 +++--- .../applications/settings/Settings.module.css | 2 +- src/components/task-bar/TaskBar.jsx | 9 ++++++-- src/components/task-bar/TaskBar.module.css | 4 ++-- .../task-bar/indicators/Battery.jsx | 4 ++-- .../task-bar/indicators/Calendar.jsx | 2 +- .../task-bar/indicators/Network.jsx | 2 +- src/components/task-bar/indicators/Volume.jsx | 2 +- src/components/task-bar/menus/HomeMenu.jsx | 21 +++++++++++------ src/components/task-bar/menus/SearchMenu.jsx | 9 +++++++- src/components/utils/DropdownButton.jsx | 8 +++++-- .../utils/DropdownButton.module.css | 4 ++-- src/components/windows/Window.jsx | 13 +++++++---- src/components/windows/Window.module.css | 2 +- src/features/applications/applications.js | 3 +-- 16 files changed, 71 insertions(+), 44 deletions(-) diff --git a/src/components/applications/file-explorer/FileExplorer.jsx b/src/components/applications/file-explorer/FileExplorer.jsx index 46c0217..b1780f7 100644 --- a/src/components/applications/file-explorer/FileExplorer.jsx +++ b/src/components/applications/file-explorer/FileExplorer.jsx @@ -68,51 +68,52 @@ export function FileExplorer({ startPath }) { return (
- - - - -
- - - -
{currentDirectory?.getFiles(showHidden)?.map((file, index) => - )} {currentDirectory?.getSubFolders(showHidden)?.map(({ name }, index) => -
{ updateShowSearch(false); }}> - ); diff --git a/src/components/task-bar/indicators/Volume.jsx b/src/components/task-bar/indicators/Volume.jsx index 6694b48..c061b31 100644 --- a/src/components/task-bar/indicators/Volume.jsx +++ b/src/components/task-bar/indicators/Volume.jsx @@ -3,7 +3,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; export function Volume() { return ( - ); diff --git a/src/components/task-bar/menus/HomeMenu.jsx b/src/components/task-bar/menus/HomeMenu.jsx index 470bad1..352243b 100644 --- a/src/components/task-bar/menus/HomeMenu.jsx +++ b/src/components/task-bar/menus/HomeMenu.jsx @@ -8,6 +8,7 @@ import { ReactSVG } from "react-svg"; import { closeTab } from "../../../features/utils/browser.js"; import { useKeyboardListener } from "../../../hooks/utils/keyboard.js"; import { useVirtualRoot } from "../../../hooks/virtual-drive/VirtualRootContext.js"; +import { useEffect, useState } from "react"; /** * @param {object} props @@ -18,6 +19,11 @@ import { useVirtualRoot } from "../../../hooks/virtual-drive/VirtualRootContext. export function HomeMenu({ active, setActive, search }) { const windowsManager = useWindowsManager(); const virtualRoot = useVirtualRoot(); + const [tabIndex, setTabIndex] = useState(active ? 0 : -1); + + useEffect(() => { + setTabIndex(active ? 0 : -1); + }, [active]); const classNames = [styles["Container-outer"]]; if (active) @@ -35,7 +41,7 @@ export function HomeMenu({ active, setActive, search }) { search(event.key); } } - } + }; const onKeyUp = (event) => { if (event.key === "Alt" && onlyAltKey) { @@ -45,7 +51,7 @@ export function HomeMenu({ active, setActive, search }) { } else { onlyAltKey = false; } - } + }; useKeyboardListener({ onKeyDown, onKeyUp }); @@ -53,16 +59,16 @@ export function HomeMenu({ active, setActive, search }) {
- - - - - {open && options ? (
{Object.entries(options).map(([label, callback]) => - - -
diff --git a/src/components/windows/Window.module.css b/src/components/windows/Window.module.css index 3f91500..cca9871 100644 --- a/src/components/windows/Window.module.css +++ b/src/components/windows/Window.module.css @@ -92,7 +92,7 @@ outline: none; } -.Header button:hover { +.Header button:hover, .Header button:focus { background-color: var(--header-button-hover-color); } diff --git a/src/features/applications/applications.js b/src/features/applications/applications.js index 7afda23..494625f 100644 --- a/src/features/applications/applications.js +++ b/src/features/applications/applications.js @@ -1,4 +1,3 @@ -/* eslint-disable eqeqeq */ import Application from "./application.js"; import { FileExplorer } from "../../components/applications/file-explorer/FileExplorer.jsx"; import { MediaViewer } from "../../components/applications/media-viewer/MediaViewer.jsx"; @@ -29,7 +28,7 @@ export default class ApplicationsManager { let application = null; this.APPLICATIONS.forEach((app) => { - if (app.id == id) { + if (app.id === id) { application = app; return; }