-
Notifications
You must be signed in to change notification settings - Fork 195
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(tooltip): rtl places tip in correct position #2736
Conversation
🦋 Changeset detectedLatest commit: 21d4cf4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
e6d28af
to
46a6ec9
Compare
🚀 Deployed on https://pr-2736--spectrum-css.netlify.app |
File metricsSummaryTotal size: 4.48 MB* Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.
Detailstooltip
* Results are not gzipped or minified. * An ASCII character in UTF-8 is 8 bits or 1 byte. |
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.
This looks great! I'm approving because this fixes the bug and the Chromatic coverage is a big improvement! 🎉
I have a question about something that existed before and may not necessarily need to be fixed:
I find these Bottom Left/Bottom Right/Top Left/Top Right tooltips very confusing when they're presented in rtl (see screenshots below). It does make sense if they're supposed to flip directions in rtl so that they're not actually left or right, but thought it would be good to confirm that's how we want them while we're here.
Great question @rise-erpelding! When RTL is on, the assumption is that the component would show a right-to-left language like Arabic, so the flipping of the UI aligns with that. I agree that calling it Left/Right is confusing in this case. We also have Start/End that look the same as Left/Right. I'm wondering if the intention in adding those was to eventually deprecate Left/Right in favor of the more Logical Property aligned naming. If that's the case, this would be a great thing to deprecate as part of the S2 migration. I'll look into doing that. |
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.
This looks good and fixes the issue with the tip placement.
I did notice one thing that seems to have regressed, that may be a slightly different bug. It might be worth trying to tackle here as well? Or a followup PR/issue.
In the YML docs, under "Show on hover", these don't appear to behave the same way anymore in RTL. These are using the CSS within a .u-tooltip-showOnHover
class (which seems unusual for our library):
const PlacementVariants = (args) => html` | ||
${window.isChromatic() | ||
? html` | ||
${placementOptions.map(option => { |
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.
👍 Nice addition that displays all the placement options
@jawinn I can't seem to replicate this, maybe I'm misunderstanding 🤔 Are you looking at "Show on hover" for the PR deploy of this PR? This is what I see: |
Yes, on that PR link. Viewed in Direction RTL. |
46a6ec9
to
1490073
Compare
/* stylelint-disable-next-line csstools/use-logical -- intentional use of non-logical property */ | ||
left: 50%; |
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.
I found that the issue @jawinn was seeing for RTL text direction in the "Show on hover" section of the docs site was caused by a regression we missed in a recent PR. I waffled on what would be the best fix for this, debating between the option to use non-logical properties or to switch the logical property in a dir(rtl)
selector. I landed on using non-logical properties intentionally because of the specifications about how the placements are intended to work, which I've documented in the tooltip.yml.
2c48cf6
to
774d2d0
Compare
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.
Looks great! Thanks for fixing that "Show on hover" issue and for adding documentation.
774d2d0
to
21d4cf4
Compare
Description
This PR aims to address issue #2707 by adjusting the left and right positions of the Tooltip for RTL. Also included is an updated Chromatic kitchen sink story to increase VRT coverage.
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
Regression testing
Validate:
Screenshots
To-do list