Comments (8)
Good news, I identified the issue and am working on a patch for it now!
from bits-ui.
@huntabyte The issue with select is confirmed fixed within this minimal repro I was working up to open a separate issue on! 🎉
https://stackblitz.com/edit/github-lsakyy
Genuinely appreciate all you do for the Svelte community!
from bits-ui.
This issue would fall back to https://github.com/huntabyte/bits-ui, so will move it there
from bits-ui.
@huntabyte Thank you, also form selector component in shadcn is broken with bits-ui 0.9.2 and can't be opened at all. You can check it in docs with form example. https://www.shadcn-svelte.com/docs/components/select#form
Version 0.9.1 works fine for me.
from bits-ui.
hm I do see that now that you mention in 🤔
from bits-ui.
Also, onOpenChange
is intended to be used for internal changes that are out of your control, and actually the logic of updating your bind:open
is handled there. So when you change it outside of it, it would end up calling it twice which I expect you wouldn't want.
from bits-ui.
The issue I'm referring to is for the select btw.
As mentioned, the onOpenChange
couldn't work the way you expect it to due to how it synchronizes the bind
state with the internal state. onOpenChange
is designed to be used when you aren't controlling the state from outside the component with bind:open
.
Otherwise, it results in behavior like this, where the change function is fired multiple times, once when it changes, and a second time when it syncs the value.
CleanShot.2023-11-09.at.20.20.29.mp4
I could possibly explore some alternative approaches to this, but is very low on my priority list at the moment.
The idea is that if you are modifying the state outside the component, you know when it is going to change and should apply whatever logic you expect to happen on change there for the time being.
from bits-ui.
Going to close this issue now as the behavior is working as initially intended, maybe in the future during a refactor (maybe svelte 5) we will be able to accommodate this, but at the moment the juice isn't worth the squeeze!
from bits-ui.
Related Issues (20)
- Tabs work incorrectly in Svelte5 HOT 3
- Buttons to have focus event
- Feature Request: Tags Input
- DateTime / Time input field widget
- `DropdownMenu.ContentProps` is typed as `any`
- Type errors when using `exactOptionalPropertyTypes`
- Svelte 5 reports plenty of a11y violations coming from bits-ui HOT 3
- Slider RTL Support not working
- DropdownMenu.Item disabled prop does not work as expected
- Fade-In and Fade-Out on Scroll Area Thumb
- [[email protected]] Menubar Trigger is broken: `Cannot destructure property 'builders' of 'getCtx$c(...)' as it is undefined.` HOT 2
- Setting Accordion's value to undefined does not collapse all HOT 2
- Setting Accordion's value to undefined does not collapse all
- Disabled property of Menubar item is not reactive
- [Svelte 5] Form controls that bind `attrs` from `Form.Control` have broken event handlers. HOT 2
- Select component submits "undefined" as a string instead of undefined primitive HOT 1
- ScrollArea.ScrollBar missing in firefox HOT 7
- Double click needed to click out of the combobox to focus an input element
- `Select.ContentProps` is typed as `any`
- Add mousedown / mouseup events to relevant bits. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bits-ui.