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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: popup now defines fallbackPositions to use when it doesn't fit the screen",
"packageName": "@fluentui/react-combobox",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
import { PositioningShorthandValue, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
import { ExtractSlotProps, Slot, useMergedRefs } from '@fluentui/react-utilities';
import type { ComboboxBaseProps } from './ComboboxBase.types';
import { Listbox } from '../components/Listbox/Listbox';
Expand All @@ -24,11 +24,15 @@ export function useComboboxPopup(
] {
const { positioning } = props;

// Set a default set of fallback positions to try if the dropdown does not fit on screen
const fallbackPositions: PositioningShorthandValue[] = ['above', 'after', 'after-top', 'before', 'before-top'];

// popper options
const popperOptions = {
position: 'below' as const,
align: 'start' as const,
offset: { crossAxis: 0, mainAxis: 2 },
fallbackPositions,
...resolvePositioningShorthand(positioning),
};

Expand Down