Skip to content

Use min/max width to prevent Close button collapsing in flex containers#42518

Open
julien-deramond wants to merge 1 commit into
v6-devfrom
v6-dev-jd-fix-btn-close-size-in-flex-containers
Open

Use min/max width to prevent Close button collapsing in flex containers#42518
julien-deramond wants to merge 1 commit into
v6-devfrom
v6-dev-jd-fix-btn-close-size-in-flex-containers

Conversation

@julien-deramond

@julien-deramond julien-deramond commented Jun 16, 2026

Copy link
Copy Markdown
Member

Context

In Alert > Dismiss, if the content more than one line, and is big, there's a rendering issue with the close button:

Screenshot 2026-06-16 at 21 30 46

However, when we use a regular button, or an icon button, the rendering turns out OK:

Screenshot 2026-06-16 at 21 28 39 Screenshot 2026-06-16 at 21 29 18

Fix

The close button used width and height set to --btn-close-size (1.5rem). These hard dimensions seems to be ignored as a minimum constraint by flex, as a flex container can shrink the button below that size when its flex-shrink kicks in.

Replacing width/height with min-width/min-height ensures the button never collapses below its intended size in any flex layout (e.g. alert dismiss rows, drawer headers), while still allowing it to grow if needed.

Screenshot 2026-06-16 at 21 31 16

Non-regression testing

I've quickly looked at components and docs using this Close button and haven't spotted any issues, but it might worth double-check.

Live previews

@github-project-automation github-project-automation Bot moved this to Inbox in v6.0.0 Jun 16, 2026
@julien-deramond julien-deramond requested a review from mdo June 16, 2026 19:33
@julien-deramond julien-deramond marked this pull request as ready for review June 16, 2026 19:34
@julien-deramond julien-deramond requested a review from a team as a code owner June 16, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant