The Invisible Work of a Focus Trap

You don't notice it when it works. You only notice it when it breaks. You open a modal. You hit Tab. The focus moves to the "Cancel" button. You hit Tab again. It moves to "Confirm". You hit Tab again. And suddenly you are in the URL bar. Or worse, you are highlighting some random link in the footer behind the gray overlay. The illusion is broken. You aren't in a "dialog"…