Skip to content

fix(webkit): keep switch chrome intact inside an input-group - #843

Open
gabriel-lisboa-azion wants to merge 1 commit into
mainfrom
fix/input-group-switch-chrome
Open

fix(webkit): keep switch chrome intact inside an input-group#843
gabriel-lisboa-azion wants to merge 1 commit into
mainfrom
fix/input-group-switch-chrome

Conversation

@gabriel-lisboa-azion

Copy link
Copy Markdown
Collaborator

What

InputGroup's button-flattening selectors now skip a Switch.

-[&_button]:!border-transparent [&_button]:!rounded-none
+[&_button:not([role=switch])]:!border-transparent [&_button:not([role=switch])]:!rounded-none

Why

InputGroup deliberately flattens the chrome of the controls it wraps — transparent borders and square corners — so a group of segments reads as one field with internal dividers. That is right for a trailing Button, an IconButton or a combobox trigger.

A Switch is also a <button>, but it is not a segment of the field: it renders a pill (rounded-[var(--shape-elements)], h-5 w-9, border-[var(--border-default)], and data-[checked]:border-transparent for its own checked state). The blanket [&_button] selectors squared its corners and erased its border with !important, so a switch placed inside a group rendered as a small grey rectangle with a floating thumb — the control still worked but no longer looked like a switch.

Scoping the two selectors with :not([role=switch]) (the role switch.vue already sets on its root) leaves every other button flattened exactly as before and hands the switch its own chrome back.

Scope

Two selectors on one class string. No props, events, slots or tokens change, and no other control matches [role=switch].

InputGroup flattens the chrome of the controls it wraps — transparent borders,
square corners — so its segments read as one field. A Switch is also a <button>
but is not a segment: it draws a pill with its own border and radius, and the
blanket [&_button] selectors erased both with !important, leaving a grey rectangle
with a floating thumb.

Both selectors are now scoped with :not([role=switch]) — the role switch.vue
already sets — so every other button flattens exactly as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants