Skip to content

fix: border radius on connected button groups#663

Open
penguinencounter wants to merge 1 commit intostoatchat:mainfrom
penguinencounter:fix-border-radius-connected-groups
Open

fix: border radius on connected button groups#663
penguinencounter wants to merge 1 commit intostoatchat:mainfrom
penguinencounter:fix-border-radius-connected-groups

Conversation

@penguinencounter
Copy link

Hopefully you don't mind this PR, apologies in advance if I did it wrong! The inconsistency was bothering me.

Before:
image

After:
image

roughly copied from the commit message:

The current styling causes border radii on connected groups to be inconsistent between buttons in the middle vs buttons on the end of the group. (This is most obvious in the Appearance tab in the settings.)

This is due to how the CSS spec handles border-radius values that cause overlapping corners (ex. the ones used to create pill-shaped buttons here) - instead of only reducing the conflicting corners, all corners are reduced proportionally as needed:
https://drafts.csswg.org/css-backgrounds/#corner-overlap

This is fixed by introducing a --max-radius CSS variable that is half of the button's height, which achieves the same effect without having corner overlaps. As a bonus, we reduce the shape: "round" variants to a single one that references the variable.

Note that there could potentially still be a consistency issue if a button is less wide than tall, but that seems very unlikely.

@infi
Copy link
Contributor

infi commented Feb 12, 2026

The affected buttons are Material 3 button groups.
Please ensure your changes comply with the spec for Material 3 button groups: https://m3.material.io/components/button-groups/specs

@penguinencounter
Copy link
Author

@infi they should, unless the existing var(--borderRadius-[size]) values are not correct
design

@penguinencounter penguinencounter force-pushed the fix-border-radius-connected-groups branch 8 times, most recently from dfb22c9 to dd48042 Compare February 13, 2026 22:39
Original styling would cause border radii on connected groups
to be inconsistent between buttons in the middle vs buttons
on the end of the group. (This is most obvious in the
Appearance tab in the settings.)

This is due to how the CSS spec handles `border-radius` values
that cause overlapping corners (ex. the ones used to create
pill-shaped buttons here) - instead of only reducing the
conflicting corners, all corners are reduced proportionally as
needed:
https://drafts.csswg.org/css-backgrounds/#corner-overlap

This is fixed by introducing a `--max-radius` CSS variable
that is half of the button's height, which achieves the same
effect without having corner overlaps. As a bonus, we reduce
the `shape: "round"` variants to a single one that references
the variable.

Note that there could potentially still be a consistency
issue if a button is less wide than tall, but that seems very
unlikely.

Signed-off-by: penguinencounter <49845522+penguinencounter@users.noreply.github.com>
@penguinencounter penguinencounter force-pushed the fix-border-radius-connected-groups branch from dd48042 to 21ef94f Compare February 20, 2026 04:42
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.

2 participants

Comments