Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ButtonGroup: Fix button and icon button styling when tooltips are used on them #4723

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Jul 8, 2024

Closes #4129

Changelog

New

Changed

  • With this PR, we are wrapping button group items with a div. The main reason is to simplify CSS selection. You can view the previous attempt to write a CSS to fix styling issues both for tooltip v1 and v2 on button group.
  • Enhanced CSS selection for the ButtonGroup children elements to ensure buttons and links still look the same if there are tooltips on them

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copy link

changeset-bot bot commented Jul 8, 2024

🦋 Changeset detected

Latest commit: 08df44e

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

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

@broccolinisoup broccolinisoup changed the title tooltip button group styling fix ButtonGroup: Fix button and icon button styling when tooltips are used on them Jul 8, 2024
Copy link
Contributor

github-actions bot commented Jul 8, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 92.49 KB (+0.09% 🔺)
packages/react/dist/browser.umd.js 92.72 KB (+0.05% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-4723 July 8, 2024 01:20 Inactive
@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/332533

@broccolinisoup broccolinisoup marked this pull request as ready for review July 11, 2024 05:27
@broccolinisoup broccolinisoup requested review from a team as code owners July 11, 2024 05:27
@github-actions github-actions bot temporarily deployed to storybook-preview-4723 July 11, 2024 05:31 Inactive
Copy link
Contributor

@mperrotti mperrotti left a comment

Choose a reason for hiding this comment

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

Looks great! I just made some suggestions to simplify the styling a little.

Just confirm that my suggestions actually work and then I'll approve.

@@ -293,6 +293,38 @@ const components = new Map([
id: 'components-buttongroup-features--icon-buttons',
name: 'Icon Buttons',
},
{
id: 'components-buttongroup-features--icon-buttons-with-tooltip',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the new way we prefer to create VRTs? I've been manually editing the .test.ts files 😅

display: inline-flex;
vertical-align: middle;
isolation: isolate;

&& > * {
&& :is(button, a) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't actually think we need :is for this. I think we can just select button and a directly

Suggested change
&& :is(button, a) {
button,
a {

:focus,
:active,
:hover {
z-index: 1;
}
}

${sx};
&& > :first-child :is(button, a) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - I don't think we need && or :is, we can just directly select button and a children of :first-child

Suggested change
&& > :first-child :is(button, a) {
> :first-child button,
> :first-child a {

border-bottom-left-radius: ${get('radii.2')};
}

&& > :last-child :is(button, a) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One more :)

Suggested change
&& > :last-child :is(button, a) {
> :last-child button,
> :last-child a {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using <Tooltip> within <ButtonGroup> affects styling
2 participants