Skip to content

fix(UIMultiSelection): show the options panel in the body; 3.1.7 - #60

Merged
gmpassos merged 3 commits into
masterfrom
fix/multi-selection-options-panel
Oct 19, 2026
Merged

gmpassos merged 3 commits into
masterfrom
fix/multi-selection-options-panel

Conversation

@gmpassos

@gmpassos gmpassos commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

UIMultiSelection rendered its options panel inside the component, positioned with position: absolute in page coordinates (window.scroll + getBoundingClientRect()). That only holds when no ancestor is the containing block of absolute elements. Under an ancestor with position, transform, filter or backdrop-filter (e.g. a "glass" panel with backdrop-filter: saturate(...)), the panel was displaced by that ancestor's offset, and the ancestor's overflow clipped it: clicking the input showed nothing, not even "no options".

Also, the panel's white background was an inline style, so an app rule styling .ui-multi-selection-options-menu never applied (on a dark theme: light text over white).

Fix

  • Shown in the body: page coordinates are right there and no ancestor clips it. Hidden, it returns to the component, after the input (also on dispose()).
  • Position corrected by where it lands (a positioned body); also placed above the input near the viewport's bottom, and re-positioned on a window resize.
  • Overridable defaults: the default look (white background, left alignment, padding) is a :where(...) rule (no specificity) injected once, not inline, so any app rule wins.
  • Inherited look kept: the component's color, font-family/-size/-style/-weight, line-height, letter-spacing and direction are passed as --ui-multi-selection-* properties to that rule, so an app rule still takes precedence, as over inheritance.
  • Lifecycle:
    • A new render keeps an open panel shown (as before), with the new options, re-positioned.
    • While shown, a 250ms check hides it if the input stops being displayed (an ancestor with display: none, e.g. a hidden dialog; the selection is notified as on any hide), or leaves the document (a removed component; its pending selection is cancelled). No mouseleave would hide it there.
  • Single selection: a radio group per instance. In the body, the radios of an instance in a <form> and of one outside it shared a group, unchecking each other's.
  • 3.1.7 (3.1.6 is tagged), with its CHANGELOG section.

Behavior change worth noting: CSS rules that select the panel through the component's ancestors (e.g. .my-box .ui-multi-selection-options-menu) no longer match it while shown. Rules on the panel's own class do, and now actually win over the defaults.

Tests (bones_ui_components_b_test.dart, "options panel placement")

  • Under a backdrop-filter + overflow ancestor: shown right under the input, in the body, with the component's font and color, and its options work; back after the input when hidden.
  • The app's CSS overrides the panel's defaults.
  • Placement on a scrolled page, with a positioned body, above the input near the bottom of the viewport, and after a window resize.
  • A new render keeps it shown; a removed component and a hidden ancestor hide it (the removed one notifying nothing); dispose doesn't leave it in the body.
  • Single selections in and out of a <form> keep their selections.

The regression tests fail on 3.1.6 (the panel landed 88px off under the backdrop-filter box). dart analyze and dart format are clean; dart test --platform vm (34) and dart test --platform chrome --compiler dart2wasm (561) pass; the UIMultiSelection groups also pass on dart2js. dart pub publish --dry-run has no warnings other than uncommitted files.

🤖 Generated with Claude Code

Inside the component the panel was positioned in page coordinates, so
under an ancestor that is the containing block of absolute elements
(`position`, `transform`, `filter`, `backdrop-filter`...) it was
displaced by that ancestor's offset, and the ancestor's `overflow`
clipped it: clicking the input showed nothing.

Shown, the panel is now attached to the document's `body` (with the
component's font and color); hidden, it returns after the input (also
on `dispose` and on a new render).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.01493% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.95%. Comparing base (ebffa1f) to head (f4b440b).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
lib/src/component/multi_selection.dart 97.01% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #60      +/-   ##
==========================================
+ Coverage   92.89%   92.95%   +0.05%     
==========================================
  Files          34       34              
  Lines        9422     9483      +61     
==========================================
+ Hits         8753     8815      +62     
+ Misses        669      668       -1     
Flag Coverage Δ
unittests 92.95% <97.01%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gmpassos and others added 2 commits October 19, 2026 17:48
… tests

- The panel's default look (background, alignment, padding) is a
  `:where(...)` rule, not inline: an app rule styling
  `.ui-multi-selection-options-menu` now applies (the inline white
  background always won: light text over white on a dark theme).
- In the `body` the component's inherited color and font properties are
  passed as `--ui-multi-selection-*` properties to that rule, so an app
  rule still takes precedence, as over inheritance.
- The position is corrected by where the panel lands (a positioned body).
- A new render keeps the panel shown, re-positioned, as before.
- While shown, it's hidden if the input stops being displayed (a hidden
  ancestor) or leaves the document (a removed component, whose pending
  selection is cancelled).
- Single selection: a radio group per instance (in the body, instances
  in and out of a form shared one).
- Tests: placement on a scrolled page, a positioned body, above the
  input, after a resize; the app's CSS overriding the defaults; a new
  render, a removed component, a hidden ancestor; radios in and out of a
  form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e viewport's height

On CI's shorter headless viewport the input (320px down) had less than
130px below it, so the panel was rightly placed above it. The input is
now scrolled to 100px below the top of the viewport.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gmpassos
gmpassos merged commit 14337fc into master Oct 19, 2026
3 checks passed
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