agentleFS
ViviBeriViviBeri/webcraft-pro/skills/keyboard-focus/SKILL.md

keyboard-focus

Skill11 starsChanged 11 days agoMITView on GitHub

Use when implementing or reviewing keyboard navigation, focus visibility, dialogs, menus, composite widgets, focus order, and keyboard interaction patterns.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 18 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All functionality must be keyboard operable without timing-dependent key sequences.

    line 14
  2. Distinctive:

    Avoid positive tabindex values.

    line 17
  3. Distinctive:

    Never create a keyboard trap.

    line 18
  4. Distinctive:

    Ensure focused content is not obscured by sticky headers, cookie banners, overlays or scroll containers.

    line 19
  5. Distinctive:

    Use Shift+Tab to verify reverse navigation.

    line 25
  6. Distinctive:

    Test Escape, arrow keys, Home and End only where the chosen widget pattern defines them.

    line 27
  7. Distinctive:

    Verify visible focus at all breakpoints, zoom levels and color themes.

    line 28
  8. Distinctive:

    Test sticky and fixed elements to ensure they do not cover focused controls.

    line 30
  9. Distinctive:

    Use the WAI-ARIA Authoring Practices Guide pattern for the exact widget before implementing custom keyboard behavior.

    line 35
  10. Distinctive:

    Prefer native controls. For custom widgets:

    line 37
  11. Distinctive:

    Keep focus and selected state distinct where the pattern requires it.

    line 39
  12. Distinctive:

    Keep ARIA state synchronized with actual behavior.

    line 40
  13. Distinctive:

    Avoid making every child a separate Tab stop when the pattern calls for managed focus.

    line 42
  14. Distinctive:

    Keep keyboard focus within the modal while it is active.

    line 48
  15. Distinctive:

    Do not apply modal focus trapping to non-modal dialogs or ordinary popovers.

    line 53
  16. Distinctive:

    Test with keyboard only, browser zoom, visible focus inspection and at least one representative assistive technology.

    line 57
  17. Distinctive:

    All controls are reachable and operable, focus is visible and unobscured, custom widgets follow a documented pattern, and focus is restored …

    line 61
  18. Distinctive:

    Prevention: Prefer native controls, follow the exact WAI-ARIA Authoring Practices pattern for custom widgets, and verify forward/reverse …

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Keyboard and Focus Engineering

Objective

Make every interactive workflow operable with a keyboard, with predictable focus movement and visible focus that is not hidden by sticky or fixed content.

Baseline rules

  • All functionality must be keyboard operable without timing-dependent key sequences.
  • Preserve a logical focus order that follows the meaning and operation of the interface.
  • Provide a clearly visible focus indicator; do not remove outlines without an equally visible replacement.
  • Avoid positive tabindex values. Prefer natural DOM order; use tabindex="0" only when a custom non-native control genuinely needs sequential focus.
  • Never create a keyboard trap. If a modal intentionally contains focus, provide a keyboard-accessible close path and predictable return.
  • Ensure focused content is not obscured by sticky headers, cookie banners, overlays or scroll containers.
  • Provide a skip link for repeated navigation where it improves efficient access.

Workflow

  1. Tab through the page from a fresh load. Record focus order and any unreachable controls.
  2. Use Shift+Tab to verify reverse navigation.
  3. Activate links and buttons with Enter and Space according to native semantics.
  4. Test Escape, arrow keys, Home and End only where the chosen widget pattern defines them.
  5. Verify visible focus at all breakpoints, zoom levels and color themes.
  6. Open each dialog or popover, verify initial focus, contained navigation where appropriate, Escape behavior and focus restoration.
  7. Test sticky and fixed elements to ensure they do not cover focused controls.
  8. Repeat after validation errors, route changes, dynamic updates and conditional rendering.

Composite widgets

Use the WAI-ARIA Authoring Practices Guide pattern for the exact widget before implementing custom keyboard behavior. Tabs, listboxes, menus, tree views and comboboxes do not share one universal keyboard model.

Prefer native controls. For custom widgets:

  • Implement only the documented interaction model.
  • Keep focus and selected state distinct where the pattern requires it.
  • Keep ARIA state synchronized with actual behavior.
  • Support expected keyboard commands and announce changes.
  • Avoid making every child a separate Tab stop when the pattern calls for managed focus.

Dialog focus lifecycle

For a modal dialog:

  1. Move focus into the dialog when it opens, usually to the most appropriate first control or a static heading for complex content.
  2. Keep keyboard focus within the modal while it is active.
  3. Make background content inert or otherwise unavailable to interaction.
  4. Support Escape when dismissal is permitted.
  5. On close, return focus to the invoking control or a logical fallback if it no longer exists.

Do not apply modal focus trapping to non-modal dialogs or ordinary popovers.

Verification

Test with keyboard only, browser zoom, visible focus inspection and at least one representative assistive technology. Verify focus after every state transition, not only initial page load.

Completion criteria

All controls are reachable and operable, focus is visible and unobscured, custom widgets follow a documented pattern, and focus is restored predictably after transient UI closes.

Common AI failure mode

Failure: An agent makes a custom control look interactive but leaves it unreachable by keyboard, removes the native focus outline, or implements a generic arrow-key model without checking the widget pattern.

Why it matters: Keyboard users can lose access to essential actions, become trapped, or lose track of their position even when the interface appears correct with a mouse.

Prevention: Prefer native controls, follow the exact WAI-ARIA Authoring Practices pattern for custom widgets, and verify forward/reverse Tab order, visible and unobscured focus, documented widget keys, Escape behavior, and focus restoration.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.