Login
From:
A Beautiful Site
(Uncensored)
subscribe
Finding the active element in a shadow root
https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
links
backlinks
Roast topics
Find topics
Find it!
You can get the focused element with document.activeElement but, if it's inside a shadow root, this will be the host element. This happens because of retargeting, but sometimes you might need access to the internal element that actually has focus.