-
Notifications
You must be signed in to change notification settings - Fork 206
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
fix(menu): prevent sp-menu-item text-align cascading #4868
Conversation
Branch previewVisual regression test resultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
|
Lighthouse scores
What is this?Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on Transfer Size
Request Count
|
Pull Request Test Coverage Report for Build 11631190725Details
💛 - Coveralls |
Tachometer resultsChromeaction-menu permalinktest-basic
test-directive permalink
test-lazy permalink
test-open-close-directive permalink
test-open-close permalink
breadcrumbs permalinkbasic-test
combobox permalinkbasic-test
light-dom-test permalink
menu permalinktest-basic
picker permalinkbasic-test
Firefoxaction-menu permalinktest-basic
test-directive permalink
test-lazy permalink
test-open-close-directive permalink
test-open-close permalink
breadcrumbs permalinkbasic-test
combobox permalinkbasic-test
light-dom-test permalink
menu permalinktest-basic
picker permalinkbasic-test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Could you look into adding a test for this? Either a new Storybook story or a check for the computed text-align value on the menu item in the scenario where it was breaking would probably work well - just to ensure it doesn’t break again. We can continue discussing with CSS to see if this should eventually be handled on their end, but for now, I’m comfortable having this solution in SWC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* fix(menu): menu item text align initial * test(menu): added menu-item text-align cascade test --------- Co-authored-by: Rúben Carvalho <rubcar@sapo.pt>
Description
Previous to the Overlay V2, the
text-align
property of action-menu, or similar components, did not cascade into thesp-menu-items
. This PR brings back that behavior by setting thetext-align: initial
onsp-menu-item
.PS: This is the same behavior as in React Spectrum. As per Spectrum guidelines I haven't yet seen a use-case for other types of aligment. If they are needed, we can provide a
--mod-*
type css variable.There is also an on-going discussion on a spectrum-css issue but this missalignment in behavior comes from the SWC's approach to Overlay so I think this is a good place to fix.
Related issue(s)
Motivation and context
Fixes the text-align cascading into the overlay menu-items.
How has this been tested?
Test case 1
text-align: center
on a parent of the ActionMenu (e.g. sp-theme)Did it pass in Desktop?
Did it pass in Mobile?
Did it pass in iPad?
Screenshots (if appropriate)
Without the change:
After the change:
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.