rtfeldman / elm-css

Typed CSS in Elm.
https://package.elm-lang.org/packages/rtfeldman/elm-css/latest
BSD 3-Clause "New" or "Revised" License
1.24k stars 197 forks source link

WebExtensions modifying CSS breaks DOM changes #473

Closed aidalgol closed 6 years ago

aidalgol commented 6 years ago

I use a WebExtension that applies a dark colour-theme to pages, and this seems to completely break elm-css. I have an app that is a variant of the inc/dec example in the Elm guides with styling applied with elm-css, and when I clicked either button (of the inc/dec buttons), a flood of domNode is undefined appeared in the console.

I have had layout breakage occur from my user-applied styles, but I have never had it cause JS errors, so I don't think this browser add-on is doing anything wrong, and this has exposed a bug in elm-css or Elm itself.

rtfeldman commented 6 years ago

This is a tricky situation!

Here are some things that are true:

It's conceivable that Elm could change how its rendering system works, to accommodate the browser extension. However, doing that can result in performance degradation for everyone who's not using the extension. Is that the right tradeoff for Elm to make?

Like I said, it's tricky!

At any rate, this is not something elm-css has any ability to affect. Any change that could possibly affect these symptoms would have have to come from one of two places:

  1. The browser extension
  2. Elm's virtual DOM

If you'd like to open an issue on the vdom system, here is a link to its issue tracker: https://github.com/elm/virtual-dom/issues

Hope that helps! Since there aren't any possible relevant elm-css changes here, I'm going to close this issue.

aidalgol commented 6 years ago

Thank you very much for the detailed response. I had a suspicion that this may be out of scope of elm-css, but decided to report it here since the problem went away when I removed my use of elm-css. I agree that there is no obvious right answer to how to resolve this clash.

Just now, I was about to open a ticket on the extension, but this appears to be a known issue and not just with Elm: darkreader/darkreader#623. One of this extension's modes of operations is essentially an injection hack, so it's no wonder it breaks Virtual DOM implementations. My apologies for not searching there before creating this issue.

rtfeldman commented 6 years ago

No worries! Thanks for posting. ♥️