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 component: fix hover/focus styles #74620

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

bluefuton
Copy link
Contributor

@bluefuton bluefuton commented Mar 20, 2023

Proposed Changes

When using a Calypso ButtonGroup, the left border of a button does not match when hovering/focusing it:

Screenshot 2023-03-20 at 3 31 31 PM

This is particularly noticeable on a 'scary' button, which has a red border.

This PR fixes the focus and hover styles for buttons within a button group so that the entire border of the current button is the same color:

Screenshot 2023-03-20 at 3 40 15 PM

Testing Instructions

Head to http://calypso.localhost:3000/devdocs/design/button-group and try hovering over/interacting with a button. Ensure that the hovered/focused button has a continuous border in the same color.

To try this component in a real world situation, take a look at http://calypso.localhost:3000/comments/all/ and try to bulk edit comments. The spam and trash buttons here should also now show a continuous border.

Screenshot 2023-03-20 at 3 40 37 PM

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

@bluefuton bluefuton added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Components [Type] Janitorial labels Mar 20, 2023
@bluefuton bluefuton self-assigned this Mar 20, 2023
@github-actions
Copy link

github-actions bot commented Mar 20, 2023

@bluefuton bluefuton marked this pull request as ready for review March 20, 2023 03:09
@bluefuton bluefuton added [Status] In Progress and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 20, 2023
@matticbot
Copy link
Contributor

matticbot commented Mar 20, 2023

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Async-loaded Components (~1 bytes removed 📉 [gzipped])

name                          parsed_size           gzip_size
async-load-design-playground        +14 B  (+0.0%)       -1 B  (-0.0%)
async-load-design                   +14 B  (+0.0%)       -1 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@bluefuton bluefuton added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Mar 20, 2023
@bluefuton bluefuton requested review from sixhours and a team March 20, 2023 03:22
Copy link
Contributor

@flootr flootr left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍🏻

There's just one glitch which I'm not sure is even relevant but when clicking on an un-scary button so it is active and then hovering over the item next to it still has the missing left border (see video below; you don't see the click unfortunately).

Screen.Recording.2023-03-29.at.15.40.23.mov

@bluefuton
Copy link
Contributor Author

There's just one glitch which I'm not sure is even relevant but when clicking on an un-scary button so it is active and then hovering over the item next to it still has the missing left border (see video below; you don't see the click unfortunately).

Excellent spot @flootr! This only seems to happen when the non-scary button has :focus styles applied, and then the following scary button has :hover. I'll see if I can come up with a fix.

@bluefuton bluefuton added [Status] In Progress and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Apr 3, 2023
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 3, 2023
@ciampo
Copy link
Contributor

ciampo commented Apr 4, 2023

Could this bug be solved by forcing the hovered/focused button to have a temporarily higher z-index?

@bluefuton
Copy link
Contributor Author

Could this bug be solved by forcing the hovered/focused button to have a temporarily higher z-index?

That's a smart idea - thanks @ciampo! I'll give that a try.

@bluefuton bluefuton removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants