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.
@antfubot

Copy link
Copy Markdown
Collaborator

Thanks for this fix!

As of #529, the client UI previously at packages/core/src/client/** (webcomponents, dock, floating popover, json-render, inject runtime, etc.) has moved out of this repo. It now lives upstream in devframe (@devframes/hub-ui / @devframes/json-render-ui), and this repo consumes it as a published dependency instead of owning the source.

Since this PR's changes target code that no longer lives here, we're labeling it devframe. We've opened devframes/devframe#205 to port this fix upstream and credit you as the original author — thank you for the work, and sorry for the churn from the migration. Feel free to pick up the port yourself against devframe (linking back to this PR) if you'd like; otherwise we'll route it through the linked issue.

@dvcolomban

Copy link
Copy Markdown
Contributor Author

I think we can close this, it has been ported to devframe already ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devframe Affected by the devframe/hub-ui migration; fix belongs upstream in devframe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants