Modal: add a real focus trap, restore focus on close, and use a unique title id
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 80/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- next.js, playwright, react, typescript
- Domain
- accessibility, frontend, testing-qa
Research direction
Start with frontend/src/components/ui/Modal.tsx, especially the focus effect and dialog header ARIA attributes, then review the modal consumers src/components/credits/BuyCreditsModal.tsx and src/components/shared/ModelDownloadModal.tsx. Add the Playwright coverage alongside the existing e2e tests, using CONTRIBUTING.md for setup commands. Done means focus remains within each open dialog, Escape restores focus to its trigger, modal instances have unique title and description IDs, and lint, build, and e2e tests pass.
Written by the indexing model from the issue text.
Description
Context
Modal is the shared dialog for the whole app. Its comment says "Focus trap", but the code only focuses the dialog container when it opens. Tab can move out of the dialog into the page behind it, and focus is not returned to the control that opened it. aria-labelledby points to a hard-coded 'modal-title' id, so nested or stacked modals produce duplicate ids, and the description is not linked with aria-describedby.
Where
frontend/src/components/ui/Modal.tsx:60-65: "focus trap" effect that only calls.focus()Modal.tsx:82:aria-labelledby={title ? 'modal-title' : undefined}- the
h2/ptitle and description inside the dialog header (about:104-113) - consumers include
src/components/credits/BuyCreditsModal.tsxandsrc/components/shared/ModelDownloadModal.tsx
What to do
- Generate ids with
useId()for the title and description, and wirearia-labelledbyandaria-describedby. - Trap Tab/Shift+Tab within the dialog's focusable elements, with no new dependency. Save
document.activeElementon open and restore it on close. - Keep the current Escape and backdrop behaviour, which depends on
closeButton.
Acceptance criteria
- A Playwright spec opens a modal, presses Tab repeatedly, and asserts that focus stays inside; after Escape, focus is back on the trigger
- Two modal instances never share ids
- lint, build and existing e2e tests pass
Getting started
Read CONTRIBUTING.md for dev setup and the quality bar (no facades, evidence before done). Comment here to claim the issue.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 3
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BeyondITL/contentine-create
-
good first issue level: 1 ui
Difficulty 2/5 1-3 hours Newbie friendliness 94/100
BeyondITL/contentine-create#58 ·
Maintainers usually reply within 1 day
-
Fix Enter on the marketplace Buy button opening details instead of buyingPossibly taken @developedbyBob claimed this 4 days ago. Openaccessibility claimed good first issue level: 1
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
BeyondITL/contentine-create#57 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Enable JSX in vitest so React component tests can runPossibly taken @29miaoet claimed this 5 days ago. Openclaimed good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
BeyondITL/contentine-create#56 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 94/100
BeyondITL/contentine-create#55 ·
Maintainers usually reply within 1 day
-
good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
BeyondITL/contentine-create#54 ·
Maintainers usually reply within 1 day
All issues in BeyondITL/contentine-create
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
appandflow/stim#5258 ·
Maintainers usually reply within 1 day
-
area/docs framework/hugo help wanted language/markdown
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 68/100
lingdojo/kana-dojo#33660 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
drizzle-team/drizzle-orm#6639 ·
Maintainers usually reply within 4 days
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100