From 213124798cb011578f0c8649cc2c46dfaa20685e Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Sun, 17 Mar 2024 17:51:05 +0100 Subject: [PATCH] Clean up docs --- README.md | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index d702982..d2e9f65 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,8 @@ For instance, KeyUX will click on this button if user press ``` -The hotkey pattern should contain modifiers like `meta+ctrl+alt+shift+b` in this exact order. +The hotkey pattern should contain modifiers like `meta+ctrl+alt+shift+b` +in this exact order. To enable this feature, call `hotkeyKeyUX`: @@ -92,7 +93,8 @@ startKeyUX(window, [ ### Hotkeys Hint -You can render the hotkey hint from the `aria-keyshortcuts` pattern in a prettier way: +You can render the hotkey hint from the `aria-keyshortcuts` pattern in +a prettier way: ```jsx import { likelyWithKeyboard, getHotKeyHint } from 'keyux' @@ -105,7 +107,7 @@ export const Button = ({ hokey, children }) => { } ``` -`likelyWithKeyboard()` returns `false` on mobile devices where user are unlikely +`likelyWithKeyboard()` returns `false` on mobile devices where user is unlikely to be able to use hotkeys (but it is still possible by connecting an external keyboard). @@ -147,8 +149,8 @@ to automatically add class for every `:active` state in your CSS. Many users want to override hotkeys because your hotkeys can conflict with their browser’s extensions, system, or screen reader. -KeyUX allows to override hotkeys using the `overrides` object. Both `hotkeyKeyUX()` -and `getHotKeyHint()` accept it as an argument. +KeyUX allows overriding hotkeys using the `overrides` object. +Both `hotkeyKeyUX()` and `getHotKeyHint()` accept it as an argument. You will need to create some UI for users to fill this object like: @@ -158,8 +160,9 @@ const overrides = { } ``` -Then KeyUX will click on `aria-keyshortcuts="b"` when Alt+B -is pressed, and `getHotKeyHint(window, 'b', overrides)` will return `Alt + B`/`⌥ B`. +Then KeyUX will click on `aria-keyshortcuts="b"` when +Alt+B is pressed, and +`getHotKeyHint(window, 'b', overrides)` will return `Alt + B`/`⌥ B`. ### Hotkeys for List @@ -214,7 +217,8 @@ with arrow navigation. ``` -Users will use Tab to get inside the menu, and will use either arrows or Home, +Users will use Tab to get inside the menu, and will use either +arrows or Home, End or an item name to navigate inside. To enable this feature, call `focusGroupKeyUX`. @@ -232,7 +236,8 @@ startKeyUX(window, [ The [`role="listbox"`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role) is used for lists from which a user may select one or -more items which are static and, unlike HTML ` elements, +may contain images. ```html