-
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(popover): offset matches spec #2246
Conversation
🚀 Deployed on https://pr-2246--spectrum-css.netlify.app |
3d038e1
to
1f3c77d
Compare
1572830
to
3909c7a
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.
The docs site looks good. I had some questions about the storybook with tip values.
a1b65db
to
f69b84b
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 good to me!
components/popover/index.css
Outdated
/* popover animates upward ⬆ */ | ||
&.is-open { | ||
--spectrum-overlay-animation-distance: var(--mod-popover-animation-distance, var(--spectrum-popover-animation-distance)); |
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.
Won't this immediately get overwritten by the same variable that's defined in the %spectrum-overlay--top--open
? Also, I'm wondering if it makes more sense to just use the one transform
line it's importing with new values rather than needing the @inherit
and needing to move the custom property after the @inherit
.
Initially I was thinking that this variable could be defined once in .spectrum-Popover.is-open
since it appears to be defined the same way for is-open on all (?) the variants. Or rather in .spectrum-Popover
--it looks like %spectrum-overlay is adding the animation distance of 6px (that has a TODO on it to replace with core tokens...), so that would have to be after the @inherit: %spectrum-overlay;
.
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.
Yeah, per that convo in the tooltip PR (#2266), I added a commit that reworks this to define the transforms in popover/index.css
instead 👍 Shouldn't change any functionality, just makes the code more readable and DRY.
File metricsOverall Δ: +4.44 KB ⬆ (+0.12%) popover+4.44 KB ⬆
|
@mdt2 When you get a chance, can you rebase this one and resolve the conflicts? |
e3cecf4
to
d1a06d3
Compare
d1a06d3
to
94077a6
Compare
Description
This has been a difficult component to test without implementing it. What I landed on is that the 8px offset distance in the spec should be accomplished by the animation.
For popovers without a tip, we can simply customize the animation-distance value to align with the spec.
For popovers with a tip, we need to add an offset margin equal to the width or height of the tip (depending on the position of the popover) so that the animation-distance is applied against the popover + tip.
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
Tip for Docs Site: If you're having trouble seeing if the animation is actually moving 8px like I was, you can turn off the visibility changes in
components/commons/overlay-coretokens.css
by changingvisibility: hidden
tovisibility: visible
andopacity: 0;
toopacity: 1;
. This will let you see the popover move up and down 8px on click.Note about positioning: We're forcing position of the popover in both the Docs site and in Storybook, but we do it in different ways on each. The Docs site uses a
dummy-spacing
class on adiv
that we can put right up next to the dummy source which gives the popover the space to move the 8px animation-distance on open/close. In Storybook there are some extra calculations. I've adjusted the offset value for each situation to give it 8px distance visually, but the values applied here weren't a uniform solution.Regression testing
Validate:
Screenshots
To-do list
I have read the contribution guidelines.
I have updated relevant storybook stories and templates.
I have tested these changes in Windows High Contrast mode.
If my change impacts other components, I have tested to make sure they don't break.
If my change impacts documentation, I have updated the documentation accordingly.
✨ This pull request is ready to merge. ✨