WICG / inert

Polyfill for the inert attribute and property.
Other
924 stars 81 forks source link

When inert library is imported more than once in a project, creates error #163

Closed angieology closed 3 years ago

angieology commented 3 years ago

This took alot of time to track down, but it's not exactly a bug, it would be nice if there was some warning against doing this. On our project we have an internal components team, which uses inert for the dialog component we import. In our local app we also use inert. The import of two inert instances create two listeners and result in unpredictable behaviour. the behaviour we found is that after the dialog closes, hidden element attributes are not cleaned up, leaving the page impossible to navigate by tab

dduupp commented 3 years ago

+1

What would be the proper way to check if the inert library has been loaded already? @robdodson

robdodson commented 3 years ago

What would be the proper way to check if the inert library has been loaded already? @robdodson

I believe inert is checking the object prototype to see if it's already defined, and if it is, it shouldn't attempt to set up again. But it sounds like maybe that's not working so we should write a test for it and see about doing a bug fix.