Skip to content

fix(core): FloatingPopover escapes a transformed ancestor's containing block; native Select mode - #518

Open
dvcolomban wants to merge 1 commit into
vitejs:mainfrom
dvcolomban:fix/json-render-select-popover-escape
Open

fix(core): FloatingPopover escapes a transformed ancestor's containing block; native Select mode#518
dvcolomban wants to merge 1 commit into
vitejs:mainfrom
dvcolomban:fix/json-render-select-popover-escape

Conversation

@dvcolomban

@dvcolomban dvcolomban commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What changed

  • FloatingPopover resolves the outermost ancestor that forms a containing block for position: fixed descendants and <Teleport>s its panel into that ancestor's parent. With no such ancestor, it renders in place as before.
  • New surface prop on FloatingPopover, tooltip (default) or menu. menu renders p0 bg-glass:25 border-#8883 in place of px2 p1 bg-glass:80 border-base.
  • Select gains native, rendering a real <select> instead of the custom listbox. It has no icon, description or searchable support.
  • Select's dropdown now uses surface="menu" and gap: 4, colours the selected option with primary and the active row with surfaceBadge, and no longer passes !p0 in panelClass.
  • webcomponents API snapshot updated for SelectProps.native.

Why it changed

A position: fixed panel is positioned relative to its nearest ancestor carrying a non-none transform or filter, not the viewport, and is clipped by that ancestor's overflow. Rendered inside such a panel, the Select dropdown was offset from its trigger and cut off — unusable. Escaping the outermost rather than the nearest such ancestor matters because escaping one can land inside another. The teleport target stays inside the shadow root, since that is where the panel's stylesheet is adopted and document.body would strip its styling.

The menu surface exists because a floating panel stacks over an already-tinted surface, where tooltip-strength glass composites to near-black, and because tooltip padding is wrong for a listbox — it inset the options and made the panel wider than its trigger.

native is an escape hatch worth having regardless of the fix above: the browser draws a native option list outside the page's layout, so no ancestor can clip or misposition it at all, which is the dependable choice for a Select embedded in a host layout this component doesn't control. Its option list needs no styling here, as ColorSchemeRoot already sets color-scheme inline and that inherits.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@518

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@518

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@518

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@518

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@518

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@518

commit: e6153ad

@dvcolomban
dvcolomban marked this pull request as draft August 5, 2026 21:42
…ect mode

- `FloatingPopover` teleports its panel out of the outermost ancestor that forms a
  containing block for `position: fixed`, so the panel is neither positioned
  relative to it nor clipped by its `overflow`. With no such ancestor it renders
  in place, unchanged. The target stays inside the shadow root, which is where the
  panel's styling comes from.
- New `surface` prop on `FloatingPopover`: `menu` drops the tooltip padding and
  uses `bg-glass:25` with a slightly stronger border, for a panel that stacks over
  an already-tinted surface where tooltip glass composites to near-black.
- `Select` gains `native`, rendering a real `<select>` whose option list the
  browser draws outside the page's layout. Trades away `icon`, `description` and
  `searchable`.
- `Select`'s dropdown adopts the `menu` surface, `gap: 4`, `primary` for the
  selected option and `surfaceBadge` for the active row.
@dvcolomban
dvcolomban force-pushed the fix/json-render-select-popover-escape branch from 59b5a4c to e6153ad Compare August 5, 2026 23:18
@dvcolomban
dvcolomban marked this pull request as ready for review August 5, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant