Modal dialogs
Correctly coding a modal requires a lot of considerations:
- When the modal opens, focus should be moved to the modal.
- While the modal is open, focus should be trapped in the modal.
- When the modal closes, focus should return to the triggering element.
- Using the ESC key should close the modal.
- Cannot tab to modal content while it is closed.
- Modal should have a clear and descriptive title.
- Should provide a visible and clear close button.