Skip to content

Fix the text in buttons not being centered properly#4620

Merged
julienw merged 2 commits into
firefox-devtools:mainfrom
julienw:fix-photon-buttons
May 16, 2023
Merged

Fix the text in buttons not being centered properly#4620
julienw merged 2 commits into
firefox-devtools:mainfrom
julienw:fix-photon-buttons

Conversation

@julienw

@julienw julienw commented May 15, 2023

Copy link
Copy Markdown
Contributor

This is a regression from #4526.

Deploy preview
production

Comment thread res/css/photon/button.css
/* These flex and sizing properties aren't necessary when a real <button> is used,
* but they are when a <a> element is used as a button. */
display: inline-flex;
box-sizing: border-box;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

buttons are border-box by default, while links are content-box. So this makes them even.

Comment thread res/css/photon/button.css
display: flex;
/* These flex and sizing properties aren't necessary when a real <button> is used,
* but they are when a <a> element is used as a button. */
display: inline-flex;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

display: flex was wrong, as this moved it from a inline element to a block element.

Comment thread res/css/photon/button.css
display: inline-flex;
box-sizing: border-box;
align-items: center;
justify-content: center;

@julienw julienw May 15, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The button have text-align: center but that doesn't work anymore once we move it to flex. With justify-content: center this should do the same thing in a flex context.

@codecov

codecov Bot commented May 15, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage has no change and project coverage change: +0.01 🎉

Comparison is base (a859e50) 88.61% compared to head (574995d) 88.63%.

❗ Current head 574995d differs from pull request most recent head c66001c. Consider uploading reports for the commit c66001c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4620      +/-   ##
==========================================
+ Coverage   88.61%   88.63%   +0.01%     
==========================================
  Files         294      294              
  Lines       26104    26086      -18     
  Branches     7039     7030       -9     
==========================================
- Hits        23132    23121      -11     
+ Misses       2766     2759       -7     
  Partials      206      206              

see 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@julienw julienw requested a review from canova May 15, 2023 20:10

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix!

@julienw julienw enabled auto-merge (squash) May 16, 2023 15:09
@julienw julienw merged commit ebdbcd5 into firefox-devtools:main May 16, 2023
@canova canova mentioned this pull request May 30, 2023
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.

2 participants