Modal windows appear directly on the inside of the current browser window, above the web page or the application. They are different from pop-up and pop-under windows that open new external windows, respectively in front of and behind the current window. Also known as lightbox, overlay or pop-in.
Modal windows take control of the current page, for as long as they are displayed on the screen. To continue navigating, the user must therefore take some action in the modal window.
Modal content can be included in a page using either of the two methods below (with the same result):
According to the choice of integration method, the behaviour will be different when JavaScript is not activated:
When a modal window is displayed on the screen:
tabindex=“0”
on the container, and set the focus there dynamically in JavaScript.tabindex=”-1”
on all the tabulable elements on the rest of the page. Esc
key on the keyboard must allow the user to close the modal window. When a modal window is closed: