Skip to content

Commit

Permalink
Ensure we handle the static prop in Tab.Panel components correctly (
Browse files Browse the repository at this point in the history
#1856)

* ensure we handle `static` panels

* update changelog
  • Loading branch information
RobinMalfait authored Sep 15, 2022
1 parent e1f3ef8 commit b346736
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/@headlessui-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Prevent option selection in `Combobox.Input` while composing ([#1850](https://github.com/tailwindlabs/headlessui/issues/1850))
- Ensure we handle the `static` prop in `Tab.Panel` components correctly ([#1856](https://github.com/tailwindlabs/headlessui/pull/1856))

## [1.7.1] - 2022-09-12

Expand Down
2 changes: 1 addition & 1 deletion packages/@headlessui-react/src/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ let Panel = forwardRefWithAs(function Panel<TTag extends ElementType = typeof DE
tabIndex: selected ? 0 : -1,
}

if (!selected && (props.unmount ?? true)) {
if (!selected && (props.unmount ?? true) && !(props.static ?? false)) {
return <Hidden as="span" {...ourProps} />
}

Expand Down
1 change: 1 addition & 0 deletions packages/@headlessui-vue/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Prevent option selection in `ComboboxInput` while composing ([#1850](https://github.com/tailwindlabs/headlessui/issues/1850))
- Ensure we handle the `static` prop in `TabPanel` components correctly ([#1856](https://github.com/tailwindlabs/headlessui/pull/1856))

## [1.7.1] - 2022-09-12

Expand Down
2 changes: 1 addition & 1 deletion packages/@headlessui-vue/src/components/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export let TabPanel = defineComponent({
tabIndex: selected.value ? 0 : -1,
}

if (!selected.value && props.unmount) {
if (!selected.value && props.unmount && !props.static) {
return h(Hidden, { as: 'span', ...ourProps })
}

Expand Down

0 comments on commit b346736

Please sign in to comment.