Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wild-cups-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@heroui/select": patch
---

fix(select): select scroll content will close immediately when popover on click (#3571, #3695)
3 changes: 2 additions & 1 deletion packages/components/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@heroui/form": "workspace:*",
"@react-aria/focus": "3.19.1",
"@react-aria/form": "3.0.12",
"@react-aria/overlays": "3.25.0",
"@react-aria/interactions": "3.23.0",
"@react-aria/utils": "3.27.0",
"@react-aria/visually-hidden": "3.8.19",
Expand All @@ -80,4 +81,4 @@
"react-hook-form": "^7.51.3"
},
"clean-package": "../../../clean-package.config.json"
}
}
5 changes: 5 additions & 0 deletions packages/components/select/src/use-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {useSafeLayoutEffect} from "@heroui/use-safe-layout-effect";
import {ariaShouldCloseOnInteractOutside} from "@heroui/aria-utils";
import {CollectionChildren, ValidationError} from "@react-types/shared";
import {FormContext, useSlottedContext} from "@heroui/form";
import {usePreventScroll} from "@react-aria/overlays";

export type SelectedItemProps<T = object> = {
/** A unique key for the item. */
Expand Down Expand Up @@ -402,6 +403,10 @@ export function useSelect<T extends object>(originalProps: UseSelectProps<T>) {
}
}, [state.isOpen, disableAnimation]);

usePreventScroll({
isDisabled: !state.isOpen,
});

const errorMessage =
typeof props.errorMessage === "function"
? props.errorMessage({isInvalid, validationErrors, validationDetails})
Expand Down
Loading