Accessible modal dialog development
A modal needs a complete lifecycle: opening, a meaningful name, focus inside, dismissal and logical return. Darkening the background does not establish that journey.
- Starting condition
A modal needs a complete lifecycle: opening, a meaningful name, focus inside, dismissal and logical return. Darkening the background does not establish that journey.
- Implementation
Use native dialog where appropriate and implement opening and closing paths. Decide initial focus, background inactivity and the destination when the opener disappears. Test long content on mobile.
- Verification
Each opener receives the correct return and dialog controls remain reachable without focus moving into the background.
- Decision
Remember the actual opener on every opening. Restore focus there if it remains, otherwise choose a logical next step. Avoid a fixed reference to the first button.
Each opener receives the correct return and dialog controls remain reachable without focus moving into the background.
Which check determines the next step?
Remember the actual opener on every opening. Restore focus there if it remains, otherwise choose a logical next step. Avoid a fixed reference to the first button.
Scope the development
A modal needs a complete lifecycle: opening, a meaningful name, focus inside, dismissal and logical return. Darkening the background does not establish that journey.
ImbaHub can help with a bounded implementation on your website. We start from the real environment, affected page types and an agreed visitor task.
What the implementation needs
Use native dialog where appropriate and implement opening and closing paths. Decide initial focus, background inactivity and the destination when the opener disappears. Test long content on mobile.
Delivery covers the agreed components, configuration, test cases and documentation. Start with a representative page. Define languages, devices and external dependencies before extending the work to the rest of the website.
| Check | Expected outcome |
|---|---|
| Starting condition | A modal needs a complete lifecycle: opening, a meaningful name, focus inside, dismissal and logical return. Darkening the background does not establish that journey. |
| Implementation | Use native dialog where appropriate and implement opening and closing paths. Decide initial focus, background inactivity and the destination when the opener disappears. Test long content on mobile. |
| Verification | Each opener receives the correct return and dialog controls remain reachable without focus moving into the background. |
| Decision | Remember the actual opener on every opening. Restore focus there if it remains, otherwise choose a logical next step. Avoid a fixed reference to the first button. |
A fictional website example
Fictional example: A comparison page opens product details from several cards. On closing, focus jumps to the document start and the visitor loses the card they were investigating.
Checks before acceptance
Each opener receives the correct return and dialog controls remain reachable without focus moving into the background.
Open by keyboard from two different buttons. Follow Tab and Shift+Tab, then close with Escape and the visible button. Inspect the active element after each dismissal and after content changes.
Delivery and ongoing ownership
Assign responsibility for changes after handover and document how to restore the previous working version. Scope and pricing follow review of the current solution and access; fixed packages or outcome levels are not assumed.
Sources and further reading
Questions, answered
What should we send to scope the work?
Use native dialog where appropriate and implement opening and closing paths. Decide initial focus, background inactivity and the destination when the opener disappears. Test long content on mobile.
Which check determines the next step?
Remember the actual opener on every opening. Restore focus there if it remains, otherwise choose a logical next step. Avoid a fixed reference to the first button.