Skip to content

ActionGroup Icon not provided padding when rendered with sibling and ActionGroup is collapsed #6477

Open
@GrantRussell

Description

Provide a general summary of the issue here

When an ActionGroup Item renders an Icon and any other sibling (like Text), then the Icon is not provided the needed padding style when in collapsed menu.

CodeSandbox to reproduce
https://codesandbox.io/p/sandbox/wizardly-james-vmfrxg?file=%2Fsrc%2FApp.js%3A13%2C58

🤔 Expected Behavior?

image
ActionGroup Icon should have equal spacing on both sides

😯 Current Behavior

image
ActionGroup Icon is pressed against Chevron

💁 Possible Solution

The issue appears to be caused by the pseudo-class :only-child used as part of the selector that applies the expected padding. The selector looks like this:

.spectrum-ActionButton .spectrum-Icon:only-child {
    padding-inline-end: var(--spectrum-actionbutton-icon-padding-x, var(--spectrum-global-dimension-size-85))
}

The problem is if you render the icon with a label, the label is still present in the DOM as a sibling to the Icon and is only hidden with CSS styles.

<ActionGroup maxWidth={100}>
  <Item key="list">
    <ViewList />
    <Text>Table View</Text>
  </Item>
</ActionGroup>

🔦 Context

No response

🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/wizardly-james-vmfrxg?file=%2Fsrc%2FApp.js%3A13%2C58

Version

3.33.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Windows 11

🧢 Your Company/Team

Adobe / Assets Essentials

🕷 Tracking Issue

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions