Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leaks when applyFocusVisiblePolyfill is applied then the element is removed #273

Open
ryuran opened this issue Nov 15, 2022 · 3 comments

Comments

@ryuran
Copy link

ryuran commented Nov 15, 2022

Hello.

Some web components with shadowDOM use focus-visible polyfill.
We apply applyFocusVisiblePolyfill when the component is attached to the DOM connectedCallback().
When the component is removed, applyFocusVisiblePolyfill keep a reference of it preventing it to be garbage collected.

So each web-component added then removed are kept in memory and it can make a huge memory leak.

Potential solution: provide a function to unapply to remove all event listener set by applyFocusVisiblePolyfill at disconnectedCallback.

More info on memory Leaks https://www.youtube.com/watch?v=YDU_3WdfkxA

@rafael-leal-mccormack
Copy link

hello, we are seeing the same issue. Is this something that will be addressed?

@robdodson
Copy link
Collaborator

Hi @rafael-leal-mccormack and @ryuran, unfortunately we don't have the bandwidth to work on this right now, but would gladly accept and review a PR if someone wanted to take the time to make one.

We are not planning any updates to this polyfill because focus-visible is now supported in all browsers, and those browsers have all moved to an evergreen model. I would be curious to know if you and @ryuran feel like you can move off of the polyfill, and if not, why?

@ryuran
Copy link
Author

ryuran commented Jan 16, 2023

Hi @robdodson our company still support officially safari >=15.0.
:focus-visible is supported only from safari >=15.4
It’s why…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants