Skip to content

Commit fbad6a9

Browse files
authored
Fix prematurely added anchoring styles on ListboxOptions (#3337)
* fix prematurely adding anchoring styles on `ListboxOptions` * update changelog
1 parent abd86fc commit fbad6a9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/@headlessui-react/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Fix prematurely added anchoring styles on `ListboxOptions` ([#3337](https://github.com/tailwindlabs/headlessui/pull/3337))
1113

1214
## [2.1.1] - 2024-06-26
1315

packages/@headlessui-react/src/components/listbox/listbox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(
983983
}, [anchor, data.options])
984984

985985
let anchorOptions = (() => {
986+
if (anchor == null) return undefined
986987
if (selectedOptionIndex === null) return { ...anchor, inner: undefined }
987988

988989
let elements = Array.from(data.listRef.current.values())

0 commit comments

Comments
 (0)