La idea general de esta solución es:
- The first focusable item in the modal dialog should receive the keyboard focus.
- The window behind the modal dialog should not be allowed to be clicked on
- The modal dialog must trap the keyboard focus inside the modal dialog so the user can’t accidentally interact with the window behind the modal dialog.
- When the user is on the last focusable item and presses Tab, the user should be taken to the first focusable item in the modal dialog.
- When the user is on the first focusable item and presses Shift-Tab, the user should be taken to the last focusable item in the modal dialog.
- The position of the keyboard focus before the modal window opens must be saved, and the focus must be restored to this location after the modal dialog closes.