An ARIA modal - option 3 (old-school)

This is how a modal had to be built before the native <dialog> element was a viable option: everything native browsers now provide for free (the dialog role, aria-modal="true", Escape to close, background inertness, focus trapping) is written by hand below. Compare with option 1 and option 2.

This content should become inert while the modal is open.

A link (should not be focusable while modal is open)

Expected results:

  1. Focus should go to the modal - either container, heading, first focusable element inside
  2. The role should be announced e.g. dialog.
  3. The current element should be announced if not the container.

Notes

Where this differs from options 1 and 2: