Skip to content

feat(remix): add containerEffects to focusable parts - #331

Open
leoafarias wants to merge 3 commits into
mainfrom
feat/remix-container-effects
Open

leoafarias wants to merge 3 commits into
mainfrom
feat/remix-container-effects

Conversation

@leoafarias

@leoafarias leoafarias commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds the containerEffects slot to the parts that take focus but could not draw an outside ring: TabStyler, ToggleStyler, ToggleGroupItemStyler, SelectMenuItemStyler, MenuItemStyler, and MenuTriggerStyler. AccordionStyler and DisclosureStyler get triggerEffects, because their containerEffects already covers the whole panel and a focus ring there would wrap the revealed content. Tooltip is not focusable and is not included.

Each part now renders through RemixBoxAdapter/RemixFlexBoxAdapter, so an outline, inset shadow, or gradient paints outside the box without taking layout space; a focus ring no longer resizes the part or shifts its neighbors, which a border does. With no effects set, the parts render exactly as before. Each spec routes the new field through RemixBoxEffectsSpec.lerpNullable so rings animate.

Side effect (fix): each part's content now keeps its state when a style adds or removes a decoration such as a focus ring; previously that rebuilt the content from scratch (a custom tab child or disclosure trigger ran initState again on focus and blur).

Notes, documented on the component pages:

  • A toggle group styled with clipBehavior (every shipped preset sets one) crops an outside ring on its end items; use a negative outlineOffset. Fortal select and menu content and accordion/disclosure panels also clip outside rings.
  • Items paint in order, so a filled item after the focused one covers that side of an outside ring; in joined rows use the inset ring or a gap.
  • A builder that returns a different widget (RemixTab.builder, RemixMenuTrigger.builder) replaces the styled container and its effects. A custom RemixAccordion.builder or RemixDisclosure.triggerBuilder widget is wrapped in triggerEffects.

Presets are unchanged; they adopt the slots after the next Remix beta.

Validation

  • New remix_box_effects_slots_test.dart: for every part, a ring paints on focus (pixel check) with identical layout before and after; accordion and disclosure rings hug the trigger; a group clip crops an outside ring and keeps a negative-offset ring; each spec's slot fades in and out through lerpNullable. Each test fails with the source reverted.
  • Rendering without effects compared against main across 295 states (idle, hover, focus, press, mid-animation, disabled, selected, open overlays, expanded panels) in unstyled, Vanilla, Vanilla at 1.6x text, Fortal, and Fortal RTL: pixels, semantics, sizes, positions, decoration, clip, padding, and alignment identical.
  • Existing container-spec assertions retargeted from Mix FlexBox/RowBox to the adapters (not weakened); props-length and diagnostics assertions bumped.
  • melos run test:flutter (every package), ci:checks, docs:check, generate:check, open-code:registry:build and open-code:apps:check (no registry or app drift), root dart format, dart analyze (no new issues).

Follow-up coverage. RemixSidebar destinations are styled with SidebarDestinationStyler, which is ToggleStyler-based, but they were drawn with Mix RowBox. A preset that moved its toggle focus ring to containerEffects therefore lost the sidebar ring.

  • Both destination layouts (settled, and collapsing or expanding) now render through RemixFlexBoxAdapter and paint containerEffects.
  • RemixAccordion now wraps a custom builder widget in triggerEffects, as RemixDisclosure already does for triggerBuilder, so a preset ring shows around a custom trigger. The trigger box is still not applied to a custom accordion trigger.
  • New tests in remix_box_effects_slots_test.dart cover the sidebar destination ring (expanded, collapsed, and mid-animation, with unchanged layout) and the accordion and disclosure custom-trigger rings. The sidebar and accordion tests fail with the source reverted.
  • A render-site audit found no other site that skips the new slots.

Merge note after #349

When rebasing onto the naked_ui 1.3.0 stack containing #349, update the SelectMenuItem case in packages/remix/test/rendering/remix_box_effects_slots_test.dart to measure Beta rather than Alpha before ArrowDown. #349 focuses Alpha on open, so it is no longer an idle baseline; ArrowDown then focuses Beta. Keep the pixel and full-layout assertions. Integration #339 contains this one-line adjustment and all 27 effects tests pass.

Related Issues

Follow-up from the HeroUI preset (ADR 0002 focus effects gap); unblocks the Vanilla, Fortal, and HeroUI adoption PRs.


Checklist

  • My PR includes unit or integration tests for all changed/updated/fixed behaviors.
  • I have updated or added relevant documentation (doc comments with ///).
  • I am prepared to follow up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

All new fields are optional. Tests that read these parts' container spec off Mix FlexBox/RowBox must read it from the adapter instead (an internal type).

Add containerEffects to the Tab, Toggle, ToggleGroup item, SelectMenuItem,
MenuItem, and MenuTrigger specs, and triggerEffects to Accordion and
Disclosure, whose containerEffects already covers the whole panel. Each
widget renders through RemixBoxAdapter or RemixFlexBoxAdapter, so an
outline paints outside the box without taking layout space.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T13:59:20.286649Z 0381b5a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

… accordion triggers

RemixSidebar drew destinations with Mix RowBox, so the containerEffects slot
that SidebarDestinationStyler (a ToggleStyler) gained never painted: a preset
that moves its toggle focus ring there lost the sidebar destination ring.
Both destination row layouts (settled and collapsing or expanding) now render
through RemixFlexBoxAdapter.

RemixAccordion painted triggerEffects only on its default trigger, while
RemixDisclosure also wraps a custom triggerBuilder widget. A custom
RemixAccordion.builder widget is now wrapped in triggerEffects too, without
applying the trigger box, so a preset ring shows around a custom trigger.
leoafarias added a commit that referenced this pull request Oct 27, 2026
# Conflicts:
#	packages/remix/CHANGELOG.md
#	packages/remix/lib/src/components/accordion/accordion_widget.dart
#	packages/remix/lib/src/components/sidebar/sidebar.dart

This branch has not been deployed

No deployments
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