Section Title
Content that can be found with Cmd+F
```
## 6. Bind global shortcuts to the right window
Keyboard shortcuts attached to `window` silently break when the component is rendered in an iframe, pop-out window, or React portal — the listener lives on the parent window, not the one the UI is in. Resolve the owning window from a mounted node so the shortcut works in any context.
```jsx
useEffect(() => {
const win = ref.current?.ownerDocument.defaultView || window;
const onKey = (e) => {
if (e.metaKey && e.key === "d") { e.preventDefault(); toggleTheme(); }
};
win.addEventListener("keydown", onKey);
return () => win.removeEventListener("keydown", onKey);
}, []);
```
## 7. Minimum 44px touch targets
Hit areas must be at least 44px on mobile and 24px on desktop (WCAG 2.5.5/2.5.8). Extend the target beyond the visible glyph with padding or a pseudo-element rather than enlarging the icon itself.
```css
.icon-btn { position: relative; }
.icon-btn::after {
content: "";
position: absolute;
inset: -12px; /* pushes a 20px icon to a 44px target */
}
```
## 8. Preserve meaningful parts in truncation
Assistive tech reads the rendered string, so truncation must keep the load-bearing segments. For file paths, clip the middle and keep the start and filename rather than cutting off the end.
```css
.path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
```
## 9. Offer single-key shortcuts as alternatives
In specialized tools, offer single-key shortcuts alongside modifier combos. Chording is physically costly for users with motor limitations; a bare key cuts the effort. Scope them so they don't fire while typing in inputs.
```js
document.addEventListener("keydown", (e) => {
if (e.target.matches("input, textarea, [contenteditable]")) return;
if (e.key === "/") openSearch();
});
```
## 10. Accept natural language as an accessible input path
Calendar pickers and complex widgets are hard to operate with a screen reader or keyboard alone. Accept plain text ("next friday", "in 3 days") as a parallel input path so the feature stays reachable without the widget.
```html