Surprising behavior of hidden state on Command.Group during filtering
#1826
Replies: 2 comments 1 reply
-
|
So upon further investigation, I had trouble reproducing this in the stackblitz editor, and turns out that this is something that is being changed by the Preflight styling from Tailwindcss: However, we're not using that, and thus were hit by the "bug" if you want to call it that. |
Beta Was this translation helpful? Give feedback.
-
|
Wow, I did not even know this was a thing tbh, but was able to repro: I'm trying to determine what the ideal approach to handling this is. While we could add This feels like something out of the scope of Bits UI to deal with/even document really, beyond perhaps mentioning that we apply the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey! We recently started using the
Commandcomponent, and we're loving almost every minute of it.The only thing we found surprising, and spent some time figuring out was how to hide the
Command.Groupduring filtering when none of the items in the group matched.After some digging, I found
bits-ui/packages/bits-ui/src/lib/bits/command/command.svelte.ts
Lines 1216 to 1217 in 7f8c035
Which on paper works great, but we ran into a bit of "strange" behavior if you wish; when you set
hiddenon a HTML element, but alsoflexas class, theflextakes precedence. I don't think we're alone in using it this way, nor being surprised.Could a potential fix be to use
data-hiddeninstead (or and to preserve backwards compatibility) instead? Or if you don't want to change it, perhaps add a warning to the docs?Repro: https://stackblitz.com/edit/egxubfvg-qx4lmb46?file=src%2Froutes%2F%2Bpage.svelte
Beta Was this translation helpful? Give feedback.
All reactions