Skip to content

Fix modal Escape handling after focus loss - #3805

Merged
AlexAndBear merged 1 commit into
mainfrom
fix/modal-escape-document
Oct 15, 2026
Merged

AlexAndBear merged 1 commit into
mainfrom
fix/modal-escape-document

Conversation

@AlexAndBear

Copy link
Copy Markdown
Member

Description

  • Listen for Escape on the document while an active modal is open, so body focus after backdrop clicks or re-renders still closes it.
  • Keep the focus trap active only for the topmost modal.
  • Add regression coverage for Escape after focus leaves the dialog, inactive modals, and loading state.

Related Issue

How Has This Been Tested?

  • test environment: local Vitest happy-dom unit test run
  • test case 1: pnpm exec vitest --config ./tests/unit/config/vitest.config.ts --run --dir packages/design-system/src/components/OcModal
  • test case 2: pnpm exec prettier packages/design-system/src/components/OcModal/OcModal.vue packages/design-system/src/components/OcModal/OcModal.spec.ts --config packages/prettier-config/index.js --check
  • test case 3: pnpm exec eslint packages/design-system/src/components/OcModal/OcModal.vue packages/design-system/src/components/OcModal/OcModal.spec.ts --color passes with existing vue/require-default-prop warnings

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@AlexAndBear
AlexAndBear merged commit d49657f into main Oct 15, 2026
28 checks passed
@AlexAndBear
AlexAndBear deleted the fix/modal-escape-document branch October 15, 2026 13:00
@openclouders openclouders mentioned this pull request Oct 15, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Escape does not close modals after focus leaves dialog

2 participants