-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Popover: fix arrow placement and design #42874
Conversation
Size Change: +368 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
8a1a39e
to
54505b5
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 the quick fix!
At first I was wondering why the Add New Template dropdown is offset a little bit lower than before and no longer overlaps the header, but I guess we can consider this a consistency improvement since it's the same offset as other Dropdowns without the arrow. Like the Options dropdown in the editor:
I see both "sides" of the argument, but I agree with your point — this could be seen as a step towards consistency. But even if we changed our mind and wanted to move the popover closer to the "Add new" button, I would suggest that we do it in a separate PR so that we keep this one focused on the arrow fix. |
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.
Awesome work here Marco! 💯
I took a brief look at this yesterday and saw the many things missing from arrow handling. I've tested your PR by changing every Dropdown we have to show an arrow and everything seemed great(both in post and site editors).
I've left a few small comments/questions and I'd like to know more especially for this one. I know you'll have some small cleanup to do, but this looks good to me!
FWIW, the Add New Template dropdown probably shouldn't have an arrow. I think it's the only dropdown in the codebase that has one, so that could be seen as an inconsistency. |
I'm not an expert when it comes to this part of the codebase, and so I'll happily let other folks make changes to that specific dropdown in a separate PR, if necessary. We can keep this PR focused on the Popover arrow fixes |
6a23692
to
04e37ba
Compare
All feedback should be addressed. I've also rebased and removed the temporary code for the Storybook example and the If no one has any objections, I'm planning on merging this PR later today. |
Fixes #42820
What?
Fix a regression introduced in #40740 about the
Popover
's arrow placement.Why?
The
Popover
's arrow has currently a few issues:How?
In order to fix the arrow placement, the following changes were implemented:
x
andy
coordinates received fromuseFloating
(mainly switching from! Number.isNaN
toNumber.isFinite
)45deg
, switched to a proper triangle (coded in SVG)$arrow-triangle-base-size
SCSS variableI've also added two extra temporary commits (which I will remove before merging)
ownerDocument
is always defined insidePopover
(this fix should probably be moved to its own separate PR)Testing Instructions
/wp-admin/site-editor.php?postType=wp_template
and click the "Add New" button in the top right part of the screen. Make sure that the Popover's arrow placement and design look correct (see this comment for more details)For extra thoroughness, you could revert the
Popover: fix arrow logic, use SVG to render triangle
commit in this PR and verify that the bug is not fixed in the scenarios described above.Screenshots or screencast
Before:
Kapture.2022-08-01.at.23.14.26.mp4
After:
Kapture.2022-08-01.at.23.10.43.mp4