mirror of https://github.com/grafana/grafana.git
Combobox: Fix option truncation w/ autoPlacement (#102568)
* Combobox: Fix option truncation w/ autoPlacement * Add back in boundary property
This commit is contained in:
parent
73436e3d55
commit
c11a37eabb
|
|
@ -1,4 +1,4 @@
|
|||
import { autoUpdate, flip, size, useFloating } from '@floating-ui/react';
|
||||
import { autoUpdate, autoPlacement, size, useFloating } from '@floating-ui/react';
|
||||
import { useMemo, useRef, useState } from 'react';
|
||||
|
||||
import { measureText } from '../../utils';
|
||||
|
|
@ -31,10 +31,11 @@ export const useComboboxFloat = (items: Array<ComboboxOption<string | number>>,
|
|||
|
||||
// the order of middleware is important!
|
||||
const middleware = [
|
||||
flip({
|
||||
// see https://floating-ui.com/docs/flip#combining-with-shift
|
||||
crossAxis: true,
|
||||
autoPlacement({
|
||||
// see https://floating-ui.com/docs/autoplacement
|
||||
allowedPlacements: ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
||||
boundary: document.body,
|
||||
crossAxis: true,
|
||||
}),
|
||||
size({
|
||||
apply({ availableWidth, availableHeight }) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue