Dialog content must gain focus immediately or as the next press of TAB once activated. Dismissing dialog content returns focus to the trigger or to the next element in DOM after the trigger.
Using a keyboard, if you encounter a dialog/modal dialog, then use a combination of TAB and SHIFT+TAB to ensure that the keyboard focus remains within the modal until closed with a close button, or the ESC key.
Using a screen reader, ensure that content outside the modal cannot be read until the modal is closed. Furthermore, if there is text which describes the purpose of the dialog, ensure that the text is automatically announced once the dialog is opened. If it is not announced, that static text should be wrapped in a div referenced by aria-describedby.
Keyboard focus and reading order with a screen reader should loop through the modal infinitely until closed.
Any modal that allows keyboard focus to escape the modal without closing it would be considered a failure of this criterion.