Skip to content

fix(Button): keep group border above highlighted buttons#651

Merged
blvdmitry merged 1 commit into
canaryfrom
claude/button-group-border-zindex-e0c6iq
Jul 4, 2026
Merged

fix(Button): keep group border above highlighted buttons#651
blvdmitry merged 1 commit into
canaryfrom
claude/button-group-border-zindex-e0c6iq

Conversation

@blvdmitry

Copy link
Copy Markdown
Contributor

Summary

The Button.Group outline border (rendered via the group's ::before pseudo-element) and a highlighted button's --highlighted layer both used --rs-z-index-relative within the same stacking context. Because the button comes later in DOM order, it painted over the border. When the highlight color is semi-transparent this goes unnoticed, but with a fully opaque highlight color (common when theming) the highlighted button masks the group border.

The fix raises the group's border/shadow pseudo-elements (::before/::after) one level above the highlighted button (calc(var(--rs-z-index-relative) + 1)), so the group border always renders on top regardless of highlight color opacity. The highlighted button still stays above its neighbouring buttons; only the thin group frame is lifted above it.

Related Issue

Fixes #649

Screenshots / Recordings

Verified in Storybook (Components/Buttongroup → new "variant: outline, highlighted" example) using an opaque #d4d4d4 highlight override. Border shown in red to make the stacking order unambiguous:

  • Before: the group border is broken/masked across the highlighted middle button.
  • After: the group border is continuous across the highlighted middle button.

Notes for Reviewers

  • Change is CSS-only in Button.module.css; the highlighted button keeps --rs-z-index-relative so its ordering relative to sibling buttons is unchanged.
  • Added a variant: outline, highlighted case to the group story, including a group that overrides --rs-color-background-neutral-highlighted-faded to an opaque grey to guard against regressions.
  • Added a changeset (patch).

🤖 Generated with Claude Code

https://claude.ai/code/session_018QGUrWA93vCuPkGwTYsg55


Generated by Claude Code

The Button.Group outline border (::before) and a highlighted button's
--highlighted layer both used --rs-z-index-relative in the same stacking
context, so the button — being later in DOM order — painted over the
border. With a fully opaque highlight color this masked the group border
(#649).

Raise the group border and shadow pseudo-elements one level above the
highlighted button so the border always renders on top, regardless of
highlight color opacity. Added a "variant: outline, highlighted" case to
the group story, including an opaque highlight override to guard the fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018QGUrWA93vCuPkGwTYsg55
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Library / JS 49.18 KB (+1.4% 🔺) 984 ms (+1.4% 🔺) 392 ms (+29.12% 🔺) 1.4 s
Library / CSS 23.07 KB (+4.03% 🔺) 462 ms (+4.03% 🔺) 0 ms (+100% 🔺) 462 ms
Theming / JS 7.81 KB (0%) 157 ms (0%) 209 ms (+335.66% 🔺) 365 ms
Theming with a default theme definition / JS 8.65 KB (0%) 174 ms (0%) 246 ms (+350.89% 🔺) 419 ms

@blvdmitry blvdmitry changed the base branch from main to canary July 4, 2026 13:34
@blvdmitry blvdmitry marked this pull request as ready for review July 4, 2026 13:39
@blvdmitry blvdmitry merged commit db93fa8 into canary Jul 4, 2026
12 checks passed
@blvdmitry blvdmitry deleted the claude/button-group-border-zindex-e0c6iq branch July 4, 2026 13:39
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.

Reshaped 4 ToggleButtonGroup theming

2 participants