Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmented Control has broken classic variant #635

Open
thien-do opened this issue Nov 30, 2024 · 2 comments
Open

Segmented Control has broken classic variant #635

thien-do opened this issue Nov 30, 2024 · 2 comments

Comments

@thien-do
Copy link

thien-do commented Nov 30, 2024

Since #621, the "classic" variant no longer has its shadow, even when it is not disabled. This can be seen in the playground of that PR:

image

I understand from the design (mentioned in the PR) that the disable style is the same for both "classic" and "surface" variants. However, I believe it's not intentional for the "classic" style to lose its shadow when not being disabled due to this change.

In fact, the absence of shadow in disabled state is more likely to be an unintentional issue. The code change (permalink) means the selectors will never match.

image

We can see this from the final CSS as well:

/* https://unpkg.com/browse/@radix-ui/[email protected]/styles.css */
.rt-SegmentedControlRoot:where(.rt-variant-surface) :where(.rt-SegmentedControlItem:not([disabled])) :where(.rt-SegmentedControlIndicator)::before {
  box-shadow: 0 0 0 1px var(--gray-a4);
}

/* https://unpkg.com/browse/@radix-ui/[email protected]/styles.css */
.rt-SegmentedControlRoot:where(.rt-variant-surface) :where(.rt-SegmentedControlIndicator)::before {
  box-shadow: 0 0 0 1px var(--gray-a4);
}

Because the structure of Segmented Control is that:

Root
- Item
- Item
- Indicator

The selector in 3.1.6 will never match anything, while the one in 3.1.4 does.

@thien-do
Copy link
Author

thien-do commented Nov 30, 2024

cc @kendallstrautman and @chaance as you folks were working on the mentioned PR 😄 (sorry in advance if I should not cc people here. This is my fisrt issue in Radix)

@kendallstrautman
Copy link
Contributor

Thanks for the report @thien-do, that change should not have affected the shadows. We'll take a look!

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

No branches or pull requests

2 participants