-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block Popover: use placement instead of position, move to useBlockToolbarPopoverProps hook #44323
Conversation
Size Change: -1 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
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, thanks!
It seems like this caused an issue with padding/margin visualizers - #44335 (comment). Not sure why though, I only found it via git bisect. 🤔 |
I see. There are other implementations of I think I'll spin up a PR to fix this (#44484). |
Thank you @glendaviesnz and @talldan for flagging and fixing the regression — and apologies for introducing it! |
What?
This PR:
placement
prop instead of the (legacy)position
prop for thePopover
component in the Block Toolbarplacement
prop from being assigned to thePopover
component inline, to theuseBlockToolbarPopoverProps
propWhy?
placement
is the prop that should be used for positioning thePopover
component. The legacyposition
prop will soon be deprecateduseBlockToolbarPopoverProps
, because the logic inside that hook really only makes sense with top/bottom placements. And so, havingplacement
closer to theuseBlockToolbarPopoverProps
logic made more sense to me (this was also reported in Ensure block toolbar doesn't overlap block by modifying forcePosition and shift popover props #42887 (comment))How?
Since
placement
needs to be always returned (regardless of whether there is enough space above the block or not), I've created aCOMMON_PROPS
object that is spread into bothDEFAULT_PROPS
andRESTRICTED_HEIGHT_PROPS
Testing Instructions
Play around with the block toolbar, make sure that its placement is the same as on
trunk
: