Skip to content

Commit

Permalink
Apply default maxHeight to Options only when a custom maxHeight is no…
Browse files Browse the repository at this point in the history
…t specified
  • Loading branch information
mattmikolay committed Feb 7, 2025
1 parent c33850a commit e8c289b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/combobox/src/Combobox/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -707,16 +707,19 @@ type OptionsProps<T extends TgphElement> = TgphComponentProps<typeof Stack<T>>;
const Options = <T extends TgphElement>({ ...props }: OptionsProps<T>) => {
const context = React.useContext(ComboboxContext);

const { maxHeight } = props;

return (
<Stack
id={context.contentId}
direction="column"
gap="1"
style={{
overflowY: "auto",
// Available Height - Padding from edge of screen
maxHeight:
"calc(var(--tgph-combobox-content-available-height) - var(--tgph-spacing-12))",
// maxHeight defaults to available height - padding from edge of screen
maxHeight: !maxHeight
? "calc(var(--tgph-combobox-content-available-height) - var(--tgph-spacing-12))"
: undefined,
}}
// Accessibility attributes
role="listbox"
Expand Down

0 comments on commit e8c289b

Please sign in to comment.