Skip to content

a11y: focus trap + initial focus for Settings / Add role / JD triage modals #26

Description

@telivity-otaip

Why

Modals (#settings, #addrole, #jdtriage, #ligoogle, legacy #rolepanel) open by toggling .hidden, and Escape already closes some surfaces — but Tab can escape into the page behind, and focus doesn’t always land on the first field.

Size

M — shared helper, wire into open/close paths.

Task

  1. Add a tiny focus-trap helper (vanilla JS, no library) used when a .modal opens:
    • move focus into the dialog (first input or close control)
    • cycle Tab / Shift+Tab inside the .box
    • restore focus to the opener on close
  2. Ensure each modal has an accessible name (aria-labelledby → existing heading, or aria-label).
  3. Keep Escape behavior consistent with today’s close paths.

Acceptance

  • Opening Settings / Add role / JD triage moves focus inside the dialog
  • Tab does not reach elements under the backdrop while open
  • Closing restores focus to the control that opened it
  • No new npm dependencies
  • npm test passes

Tips

Drawer already has role="dialog" aria-modal="true". Prefer matching that pattern. Avoid rewriting the whole hybrid IA.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions