lxsmnsyc / solid-floating-ui

SolidJS bindings for Floating UI
MIT License
84 stars 3 forks source link

TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. #6

Open itsyoboieltr opened 10 months ago

itsyoboieltr commented 10 months ago

I am trying to use the library in SolidStart. I keep on getting this error:

(home).tsx:13 TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at getComputedStyle (floating-ui.utils.dom.mjs?v=ec75b833:72:29)
    at isOverflowElement (floating-ui.utils.dom.mjs?v=ec75b833:40:7)
    at getOverflowAncestors (floating-ui.utils.dom.mjs?v=ec75b833:123:55)
    at Object.autoUpdate [as whileElementsMounted] (floating-ui.dom.mjs?v=ec75b833:526:75)
    at Object.fn (index.mjs?v=ec75b833:71:33)
    at runComputation (chunk-RPEO2QY4.js?v=ec75b833:707:22)
    at updateComputation (chunk-RPEO2QY4.js?v=ec75b833:689:3)
    at runTop (chunk-RPEO2QY4.js?v=ec75b833:798:7)
    at runUserEffects (chunk-RPEO2QY4.js?v=ec75b833:907:36)
    at chunk-RPEO2QY4.js?v=ec75b833:865:34
gabrielmfern commented 9 months ago

I also had this. Seems like, after a lot of debugging, this is being caused because the ref is set before the element is actually inserted into the DOM which causes floating-ui to not find its parent's computed styles.

itsyoboieltr commented 8 months ago

I also had this. Seems like, after a lot of debugging, this is being caused because the ref is set before the element is actually inserted into the DOM which causes floating-ui to not find its parent's computed styles.

Could you fix it? @gabrielmfern

gabrielmfern commented 8 months ago

@itsyoboieltr Here's a link for the support thread on Discord that others from the community helped me in fixing it

https://discord.com/channels/722131463138705510/1215409288030330972

beoxgame commented 6 months ago

@itsyoboieltr Here's a link for the support thread on Discord that others from the community helped me in fixing it

https://discord.com/channels/722131463138705510/1215409288030330972

I can't open this link, can you show me the code to let me known how to fix it?

gabrielmfern commented 6 months ago

@beoxgame it's a bit of a long thread, the error might have a lot of causes, but in my situation it was my code rendering twice due to a bundler of mine. You need Discord installed for the link to work, it was inside of Solid's Discord server.

beoxgame commented 6 months ago

@beoxgame it's a bit of a long thread, the error might have a lot of causes, but in my situation it was my code rendering twice due to a bundler of mine. You need Discord installed for the link to work, it was inside of Solid's Discord server.

thx, after joined solid's channel, the link is working fine.