Skip to content

Conversation

@HadassahYelenik
Copy link
Collaborator

@HadassahYelenik HadassahYelenik commented Sep 9, 2025

relates to issue #2558

What I did

  1. Created a new rh-button-group web component.

  2. Added styling (rh-button-group.css) to handle button layout and spacing.

  3. Built a demo page (demo/index.html) to showcase component usage.

  4. Implemented TypeScript functionality (rh-button-group.ts) for component behavior.

Testing Instructions

  1. Open elements/rh-button-group/demo/index.html in a browser.

  2. Verify that the buttons display correctly in a group layout.

  3. Click the buttons to ensure any interactions work as expected.

  4. Optional: Integrate the component into a test page in the repo to see it in context.

Notes to Reviewers

  1. This is a new component, so no breaking changes to existing functionality.

  2. Styles and behavior are confined to rh-button-group.

  3. Feedback welcome on styling, accessibility, and any API improvements.

@changeset-bot
Copy link

changeset-bot bot commented Sep 9, 2025

🦋 Changeset detected

Latest commit: 7b9a33f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rhds/elements Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Sep 9, 2025

Deploy Preview for red-hat-design-system ready!

Name Link
🔨 Latest commit 7b9a33f
🔍 Latest deploy log https://app.netlify.com/projects/red-hat-design-system/deploys/6910712c4e23840008ee0802
😎 Deploy Preview https://deploy-preview-2605--red-hat-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bennypowers
Copy link
Member

@adamjohnson please give this a ux review

@coreyvickery you mentioned in internal chat some design guidelines, if it's not too much trouble, please add (publically accessible) links to those design files here

@coreyvickery
Copy link
Collaborator

I just grabbed spacing guidance from PatternFly 6.

And here are their spacer token values.

@github-project-automation github-project-automation bot moved this from Done ☑️ to In Progress 🟢 in Red Hat Design System Sep 14, 2025
@coreyvickery
Copy link
Collaborator

@bennypowers Should any docs updates be handled in this issue?

@github-project-automation github-project-automation bot moved this from In Progress 🟢 to Review 🔍 in Red Hat Design System Sep 14, 2025
@coreyvickery
Copy link
Collaborator

@bennypowers @markcaron Does this need to be a separate element? Can it be a part of the Button element?

@bennypowers
Copy link
Member

@coreyvickery consider these examples (final attributes may change):

<rh-button-group>
  <rh-button>Shutdown</rh-button>
  <rh-button>Restart</rh-button>
  <rh-button>Logout</rh-button>
</rh-button-group>


<rh-button-group variant="radio">
  <rh-button>Dark</rh-button>
  <rh-button>Light</rh-button>
  <rh-button>System</rh-button>
</rh-button-group>


<rh-button-group>
  <rh-menu-dropdown>...</rh-menu-dropdown>
  <rh-button>Manage Account</rh-button>
</rh-button-group>

button group is a container for buttons

@coreyvickery
Copy link
Collaborator

Got it. Docs are in progress! 🙂

@HadassahYelenik
Copy link
Collaborator Author

Thank you for the detailed review.
I am addressing all the required fixes and will push the updates once they are complete. I appreciate your involvement and guidance in getting this PR ready to merge.

@coreyvickery
Copy link
Collaborator

@HadassahYelenik I can't see the demo, please fix when you see this so I can complete the docs.

@bennypowers
Copy link
Member

bennypowers commented Sep 15, 2025

Some notes (not necessarily directly related to this pr) for your consideration which came from a meeting we had earlier.

In a future version of Button Group, we hope to implement split dropdown in Button Group. I. E. split button where one of the buttons opens a dropdown. Although we're not sure we're going to be able to do it on this first round.

@coreyvickery coreyvickery self-assigned this Sep 16, 2025
@coreyvickery coreyvickery added for dev Ready for development blocked Issue is blocked good 1st issue Good first issue labels Sep 16, 2025
@HadassahYelenik
Copy link
Collaborator Author

@coreyvickery thanks for letting me know, I’m looking into the issue now and will update the branch once it’s fixed.

@markcaron markcaron changed the title Rh button group feat: <rh-button-group> Sep 16, 2025
@coreyvickery coreyvickery self-requested a review September 23, 2025 01:33
Copy link
Collaborator

@coreyvickery coreyvickery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HadassahYelenik Some changes requested:

  • Space between buttons in a row is --rh-space-lg (16px)
  • Space between buttons in a column is --rh-space-md (8px)
  • For more information, please read through the docs

@coreyvickery
Copy link
Collaborator

@adamjohnson Docs are here if you'll be working on them.

@adamjohnson
Copy link
Collaborator

@adamjohnson Docs are here if you'll be working on them.

@HadassahYelenik should be able to handle coding the docs up. Let us know if you have any questions. Reference other elements/files ala elements/rh-/docs/ to see the coding patterns we use.

@HadassahYelenik HadassahYelenik force-pushed the rh-button-group branch 2 times, most recently from bd39b83 to d8026ce Compare October 19, 2025 10:48
@HadassahYelenik
Copy link
Collaborator Author

Fixed the CSS lint errors in rh-button-group.css. The remaining failures are unrelated — existing ESLint errors in _plugins and a Netlify build issue from the @patternfly/pfe-tools patch. All button group files are passing now.

Copy link
Member

@bennypowers bennypowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the PR title to

feat(button-group): add `<rh-button-group>` element

@HadassahYelenik HadassahYelenik changed the title feat: <rh-button-group> feat(button-group): add <rh-button-group> element Oct 22, 2025
@coreyvickery
Copy link
Collaborator

@HadassahYelenik Below is the image for the All elements page. File path would be: /elements/button-group/screenshot.png

The body text is:

Organize multiple related buttons into a single collection

screenshot

cc @adamjohnson If you need to do this instead.

@HadassahYelenik
Copy link
Collaborator Author

@HadassahYelenik Below is the image for the All elements page. File path would be: /elements/button-group/screenshot.png

The body text is:

Organize multiple related buttons into a single collection

screenshot cc @adamjohnson If you need to do this instead.

Screenshot added to /elements/rh-button-group/docs/screenshot.png. Thanks! I see the body text would go in index.njk, so I’ll leave that part for @adamjohnson unless told otherwise.

Copy link
Collaborator

@adamjohnson adamjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things to think about:

  1. Possible API changes around role="group" and role="toolbar"
  2. Updates to docs imagery and content
  3. Possible additon of an orientation demo
  4. Possible changes to tests.

Also, instead of having the base branch based on main (or RedHat-UX:main), it should be based off of staging/eevee.

</figure>

### Orientation

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Button groups are available in both horizontal and vertical orientations.

Check the white space here, sometimes it's hard to get right when commenting on Github.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if the docs are calling out "vertical orientations", that likely means we'll have to properly handle aria-orientation and include demos for a vertical orientation too. (See discussion above).

@@ -0,0 +1,17 @@
<rh-button-group role="group">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding role="group" (and with regard to the considerations in the discussion a few lines below this one), could we handle this with the InternalsController? We generally use the InternalsController to define semantics like this. eg rh-navigation-link.

If we need to change the role, rh-icon has an example of that. That said, I don't know if that will be necessary if we decide to make <rh-button-group-toolbar> (or whatever it would be named).

Comment on lines 8 to 12
<rh-button-group role="group">
<button type="button">Save</button>
<button type="button">Cancel</button>
<button type="button">Delete</button>
</rh-button-group>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example will likely change as we make API changes as discussed below.

Comment on lines 10 to 14
<rh-button-group role="group">
<rh-button>Save</rh-button>
<rh-button>Cancel</rh-button>
<rh-button>Delete</rh-button>
</rh-button-group>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example will likely change as we make API changes as discussed below.

Comment on lines 31 to 52
it('should set tabindex=0 for group role', async function() {
const element = await createFixture<RhButtonGroup>(html`
<rh-button-group role="group">
<rh-button>Save</rh-button>
<rh-button>Cancel</rh-button>
</rh-button-group>
`);
await element.updateComplete;

const buttons = element.querySelectorAll('rh-button');
buttons.forEach(button => {
expect(button.getAttribute('tabindex')).to.equal('0');
});
});

it('should handle role="toolbar" with roving tabindex', async function() {
const element = await createFixture<RhButtonGroup>(html`
<rh-button-group role="toolbar">
<rh-button>Edit</rh-button>
<rh-button>Copy</rh-button>
<rh-button>Delete</rh-button>
</rh-button-group>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind, these tests may change if we change the API, as discussed above.

- Fix themable decorator to use @themable pattern consistently with other RHDS elements
- Refactor slot change handling with cleaner method separation
- Improve event binding using declarative @slotchange in template
- Add comprehensive test coverage for role-based tabindex behavior
- Add tests for group vs toolbar role functionality
- Add E2E tests for DOM rendering validation
- Ensure proper accessibility and roving tabindex controller testing
@HadassahYelenik HadassahYelenik changed the base branch from main to staging/eevee November 5, 2025 09:50
@bennypowers bennypowers dismissed their stale review November 5, 2025 11:30

my changes were addressed

@HadassahYelenik
Copy link
Collaborator Author

HadassahYelenik commented Nov 6, 2025

Thanks for the detailed feedback @adamjohnson!

I understand that role="toolbar" should wrap multiple button groups, and that role="group" semantics are better handled internally via InternalsController. A wrapper like <rh-button-group-toolbar> could make sense for toolbar-level roles and labels. We’d also need to support labeling and possibly an optional orientation property if vertical toolbars are required.
Separately, individual button groups could handle vertical orientation within the group layout, as noted in the docs.

How would you like me to proceed:
implement InternalsController now, explore a <rh-button-group-toolbar> wrapper, or keep manual roles for this pass?
I’m happy to implement whichever approach you and @bennypowers decide makes the most sense.

In the meantime, I’ve:
Rebased onto staging/eevee, converted docs images to SVG, improved alt text for the spacing diagram, added default slot documentation, and updated aria-label → label on icon-only buttons.

@adamjohnson
Copy link
Collaborator

@HadassahYelenik:

How would you like me to proceed:
implement InternalsController now, explore a wrapper, or keep manual roles for this pass?

  1. Implement InternalsController now Yes! Let's do this.
  2. Explore a <rh-button-group-toolbar> wrapper Yes, do this.

…tion property

- Add InternalsController to automatically set role='group'
- Remove RovingTabindexController and toolbar-related logic
- Add orientation property ('horizontal' | 'vertical') with default 'horizontal'
- Add CSS support for vertical orientation with flex-direction: column
- Organize demos into separate pages: index.html, horizontal.html, vertical.html
- Update tests to follow rh-navigation-link pattern using @open-wc/testing
- Remove manual role attributes from README and changeset examples
@HadassahYelenik
Copy link
Collaborator Author

Thanks @adamjohnson!
I added InternalsController, removed toolbar logic, added orientation property, and updated demos/tests.

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

Labels

blocked Issue is blocked for dev Ready for development good 1st issue Good first issue

Projects

Status: Review 🔍

Development

Successfully merging this pull request may close these issues.

[feat] Create <rh-button-group> element

5 participants