LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 19, 2026, 3:47 AM
updatedAtNov 19, 2026, 10:58 AM
githubUrlhttps://github.com/neomjs/neo/issues/21423
authorneo-opus-vega
commentsCount0
parentIssue21367
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[x] 21439 Dialogs & Overlays shows the dialog, the toast and the popover working
closedAtNov 19, 2026, 10:58 AM

A popover opens at its target, placed by CSS anchor positioning

neo-opus-vega
neo-opus-vega commented on Nov 19, 2026, 3:47 AM

Parent: #21367 (Dialogs & Overlays: the popover's defect is fixed before its card is renewed). Promotes defect-note 0bd1ec00.

Context

In examples/popover, a click on "Click Me" opens the popover clipped into the window's top-left corner, not at the button (defect-note 0bd1ec00). Re-measured on dev 267eb2336f at 1024 × 768 in Chromium: the button spans x 217–417, y 407–431; the open popover spans x −135–135, y 8–72, so half of it is off the left edge. The popover element carries anchor="neo-button-1". The browser reports position-anchor, position-area and position-try-fallbacks as supported (CSS.supports), and 'anchorElement' in HTMLElement.prototype as false.

Live latest-open + closed sweep: checked the latest 20 open plus open and closed search ("popover") at 2026-11-19T02:35Z and again at 02:47Z; the one closed hit, #19933, fixed a load error and leaves placement alone. 75 open, red band: folds under #21367. A2A in-flight sweep: latest 12 messages in all read-states at 02:35Z and 6 at 02:47Z; no claim on the popover. MC sweep: "popover opens in the top-left corner instead of aligned to its target", 5 results, none about this plugin. Own-assignment sweep: 8 open, none overlapping (#21415 is the dialog leaf).

The Problem

Neo.plugin.Popover was written against the 2023 draft of CSS anchor positioning:

  • it ties the popover to its target with the HTML anchor attribute (src/plugin/Popover.mjs, vdom: {anchor: owner.id}), which no shipping browser implements;
  • its placements are @position-fallback rules with anchor() insets, an at-rule the specification renamed to @position-try before any browser shipped it;
  • those rules live in resources/css/src/examples/popover/MainContainer.css, so the engine's plugin has no placement of its own, and no theme gives the popover colours.

With no anchor, the UA's [popover] style and the example's inset: unset leave the popover at the top-left of the viewport.

The Architectural Reality

Design authority: "Defaults to bottom center of popover is aligned to top center of owner" — Neo.plugin.Popover#align (src/plugin/Popover.mjs:53), whose valid values are alignValues (bc-tc, tc-bc, tl-tr, tr-tl, cl-cr, cr-cl).

  • The plugin adds a Neo.container.Base with vdom.popover: 'auto' next to its owner, and stamps popovertarget on the owner (the native invoker toggles it on click); Neo.main.addon.Popover shows and hides it on hover.
  • Vdom style keys reach the DOM through style.setProperty(Neo.decamel(key)) (src/main/DeltaUpdates.mjs:945), so anchorName and positionAnchor arrive as anchor-name and position-anchor.
  • Plugin styles live in resources/css/src/plugin/ (Resizable.css, PrefixField.css).

The Fix

  1. Neo.plugin.Popover: the owner gets style.anchorName: '--<popoverId>', the popover style.positionAnchor with the same name; the anchor attribute goes.
  2. resources/css/src/plugin/Popover.css: one rule per align value with position-area (bc-tc → top, tc-bc → bottom, tl-tr → right span-bottom, tr-tl → left span-bottom, cl-cr → right, cr-cl → left) and position-try-fallbacks (flip-block above and below, flip-inline beside), plus the margin, radius and shadow; colours from theme tokens in every theme.
  3. examples/popover: its stylesheet keeps only what the example itself needs; the stage title stops reading Neo.container.Base.

Acceptance Criteria

  • In examples/popover, "Click Me" opens the popover centred above the button, and each align value places it on its side of the target. An e2e spec measures the popover's rect against the button's.
  • Near a viewport edge the popover flips to the other side instead of leaving the screen. Same spec.
  • The popover reads in every theme. Before/after frames in the PR.

Out of Scope

  • Browsers without CSS anchor positioning: they show the popover where the UA puts it, as today.
  • The popover card's cover and the Dialogs & Overlays renewal (#21367's renewal leaf).
  • The dialog's mask and focus (#21415).

Avoided Traps

  • Aligning in JS with Neo.main.DomAccess#align: the plugin is built on the native popover, and the browser already places it against a named anchor without a round trip per scroll.
  • Porting @position-fallback to @position-try one to one: position-area and the flip-* keywords say the same in a line each.

Related

#21367 · defect-note 0bd1ec00 · #21415.