Skip to content

Commit

Permalink
fix: Select/Combobox scroll conflicts (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Feb 1, 2025
1 parent accf52f commit 9efd957
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 208 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-rice-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

fix: Select/Combo scroll
2 changes: 1 addition & 1 deletion packages/bits-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@internationalized/date": "^3.5.6",
"esm-env": "^1.1.2",
"runed": "^0.23.2",
"svelte-toolbelt": "^0.7.0"
"svelte-toolbelt": "^0.7.1"
},
"peerDependencies": {
"svelte": "^5.11.0"
Expand Down
1 change: 1 addition & 0 deletions packages/bits-ui/src/lib/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ declare global {
readonly map: SvelteMap<string, boolean>;
resetBodyStyle: () => void;
};
var bitsAnimationsDisabled: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,19 @@
...restProps
}: SelectScrollDownButtonProps = $props();
let mounted = $state(false);
const scrollDownButtonState = useSelectScrollDownButton({
const scrollButtonState = useSelectScrollDownButton({
id: box.with(() => id),
mounted: box.with(() => mounted),
ref: box.with(
() => ref,
(v) => (ref = v)
),
});
const mergedProps = $derived(mergeProps(restProps, scrollDownButtonState.props));
const mergedProps = $derived(mergeProps(restProps, scrollButtonState.props));
</script>

{#if scrollDownButtonState.canScrollDown}
<Mounted onMountedChange={(m) => (mounted = m)} />
{#if scrollButtonState.canScrollDown}
<Mounted onMountedChange={(v) => (scrollButtonState.state.mounted = v)} />
{#if child}
{@render child({ props: restProps })}
{:else}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,19 @@
...restProps
}: SelectScrollUpButtonProps = $props();
let mounted = $state(false);
const scrollDownButtonState = useSelectScrollUpButton({
const scrollButtonState = useSelectScrollUpButton({
id: box.with(() => id),
mounted: box.with(() => mounted),
ref: box.with(
() => ref,
(v) => (ref = v)
),
});
const mergedProps = $derived(mergeProps(restProps, scrollDownButtonState.props));
const mergedProps = $derived(mergeProps(restProps, scrollButtonState.props));
</script>

{#if scrollDownButtonState.canScrollUp}
<Mounted onMountedChange={(m) => (mounted = m)} />
{#if scrollButtonState.canScrollUp}
<Mounted onMountedChange={(v) => (scrollButtonState.state.mounted = v)} />
{#if child}
{@render child({ props: restProps })}
{:else}
Expand Down
Loading

0 comments on commit 9efd957

Please sign in to comment.