A CSS Approach to Trap Focus Inside of an Element

I recently read this article by Keith Grant which introduced the newly arrived

. Excited by this new UI element, I immediately sat down to experiment with it to see how it can be used effectively as a modal — the most common use of it. While experimenting, I discovered a neat CSS trick on how to trap focus within the <dialog> element, a common accessibility requirement for modals, and a notoriously difficult one.
What is focus trapping?
First, …
The post A CSS Approach to Trap Focus Inside of an Element appeared first on CSS-Tricks.

Link: https://css-tricks.com/a-css-approach-to-trap-focus-inside-of-an-element/