The modal dialog pattern defines how pop-ups, confirmation prompts, image lightboxes, and cookie banners, should behave for keyboard and screen reader users: focus moves into the dialog when it opens, Tab cycles only among the elements inside it (a focus trap), Escape closes it, and focus returns to whatever element opened it once it is dismissed.
Modals that skip the focus trap let a keyboard user tab silently behind the dialog into the page underneath, while modals that never return focus on close leave a keyboard user disoriented, having to navigate the whole page again to find where they were.