fix(channels): keep the About popover on-screen at high browser zoom
At elevated zoom the CSS viewport shrinks; a long channel About wanted its fixed max-h-112 (448px) height, so when floating-ui flipped it above the trigger its top rendered above the viewport edge, clipped and unreachable (the inner overflow-y-auto can't scroll past its own top). Enable the popover's fitHeight so the `size` middleware caps the panel to the available space. Because the surface splits into an outer positioned element and an inner styled/scroll wrapper, the middleware now also publishes the available height as a --fit-max-h custom property the inner scroller consumes via maxHeight: min(28rem, var(--fit-max-h)), keeping the 28rem design cap on a tall viewport and shrinking to fit on a short one.
This commit is contained in:
@@ -131,7 +131,14 @@ export function useAnchoredPopover(opts: AnchoredPopoverOptions) {
|
||||
size({
|
||||
padding: 8,
|
||||
apply({ availableHeight, elements }) {
|
||||
// Cap the positioned element, AND publish the available space as a custom property so
|
||||
// the INNER styled/scroll wrapper (PopoverSurface renders `className` on a child, not on
|
||||
// the floating element) can cap itself too — e.g. `maxHeight: min(28rem, var(--fit-max-h))`
|
||||
// keeps a caller's design cap while still shrinking to fit at high zoom / short viewports.
|
||||
// Capping only the outer element would leave the inner overflow-y-auto box at its fixed
|
||||
// height, spilling its top off-screen (the whole point of fitHeight).
|
||||
elements.floating.style.maxHeight = `${availableHeight}px`;
|
||||
elements.floating.style.setProperty("--fit-max-h", `${availableHeight}px`);
|
||||
},
|
||||
}),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user