← I Stopped Checking relatedTarget. :focus-within Does It in CSS.
Playground
:focus-within — interactive playground
preview
Edits run in a sandbox in your browser — nothing is saved and nothing leaves the page.
Edits run in a sandbox in your browser — nothing is saved and nothing leaves the page.