Skip to content

ButtonGroup does not stack on screen resize if the Buttons have no breaks in labels #5679

Description

@davidferguson

Provide a general summary of the issue here

The <ButtonGroup> in a horizontal orientation does not stack to a vertical orientation on screen resize, if none of the <Button> children have a break (space, dash, etc.) in their label.

🤔 Expected Behavior?

The <ButtonGroup> in horizontal orientation that has <Button> children with no spaces in their labels should stack vertically when the screen is resized to a width smaller than the ButtonGroup width.

😯 Current Behavior

The <ButtonGroup> does not stack when the screen is resized.

However, adding a single space to any of the <Button> labels does make the ButtonGroup stack.

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

Codesandbox demo

Reproduction code (in case the codesandbox link no longer works):

// this does not stack
<ButtonGroup>
  <Button variant="primary">nospace</Button>
  <Button variant="secondary">nospace</Button>
  <Button variant="secondary">nospace</Button>
</ButtonGroup>

// this stacks fine
<ButtonGroup>
  <Button variant="primary">with space</Button>
  <Button variant="secondary">nospace</Button>
  <Button variant="secondary">nospace</Button>
</ButtonGroup>

Version

latest

What browsers are you seeing the problem on?

Firefox, Chrome, Safari

If other, please specify.

No response

What operating system are you using?

macOS 12.4

🧢 Your Company/Team

Adobe

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions