Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-buttons-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/kumo": patch
---

Preserve ButtonGroup's outer corners while an overlay control is open.
13 changes: 13 additions & 0 deletions packages/kumo/src/components/button-group/button-group.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ describe("ButtonGroup", () => {
expect(screen.getByRole("group").className).toContain("flex-row");
});

it("ignores non-control siblings mounted by an open overlay", () => {
render(
<ButtonGroup>
<Button>One</Button>
<Button>Two</Button>
<span data-portal-placeholder="" />
</ButtonGroup>,
);
expect(screen.getByRole("group").className).toContain(
"[&>*:is(button,a):has(~_:is(button,a))]:rounded-e-none",
);
});

it("uses logical child-position selectors to join controls", () => {
render(
<ButtonGroup>
Expand Down
2 changes: 1 addition & 1 deletion packages/kumo/src/components/button-group/button-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const KUMO_BUTTON_GROUP_STYLING = {
// and LinkButton groups retain the correct outer corners. The one-level
// descendant selectors support Button's tooltip wrapper.
"[&>*:not(:first-child):is(button,a)]:rounded-s-none",
"[&>*:not(:last-child):is(button,a)]:rounded-e-none",
"[&>*:is(button,a):has(~_:is(button,a))]:rounded-e-none",
"[&>*:not(:first-child)>:is(button,a)]:rounded-s-none",
"[&>*:not(:last-child)>:is(button,a)]:rounded-e-none",
// Overlap borders/rings by 1px so adjacent buttons share a single seam
Expand Down
Loading