Skip to content

[Improvement]: A11y — focus trap, role=dialog and return-focus for Settings and Permission modals #106

@matiaspalmac

Description

@matiaspalmac

Describe the improvement

Modals do not trap focus and do not restore focus on close:

  • Settings modal at apps/desktop/src/components/SettingsView.tsx:382-475 is a plain <div> (no role="dialog", no aria-modal, no aria-labelledby). Its Escape handler is attached to the div, which isn't focusable, so it never fires.
  • Permission request dialog at apps/desktop/src/addons/builtin.ai-assistant/AiChatComponent.tsx:775-804 has no ARIA role and no focus management.

Proposed change:

For each dialog:

  1. Apply role="dialog" aria-modal="true" aria-labelledby="…title".
  2. Move focus to the first interactive element on open; restore focus to the trigger on close.
  3. Implement a focus trap (Tab/Shift+Tab cycle within the dialog).
  4. Attach the Escape listener to document while the dialog is open.

Would you like to implement this improvement yourself by sending a PR?

Maybe

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions