-
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
Dropdown
: deprecate position
prop, use popoverProps
instead
#46865
Conversation
The direction in which the popover should open relative to its parent node. Specify a y- and an x-axis as a space-separated string. Supports `"top"`, `"bottom"` y-axis, and `"left"`, `"center"`, `"right"` x-axis. | ||
|
||
- Required: No | ||
- Default: `"top center"` |
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'm not sure that the documented default value for position
was correct — the position
prop didn't seem to have any default value assigned, and even the prop's default value in the Popover
component is different
options: [ 'firstElement', true, false ], | ||
control: { | ||
type: 'radio', | ||
options: [ 'firstElement', true, false ], |
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 is to fix a warning in Storybook
Dropdown
: deprecate position
propDropdown
: deprecate position
and focusOnMount
props
Dropdown
: deprecate position
and focusOnMount
propsDropdown
: deprecate position
prop, use popoverProps
instead
position={ position } | ||
popoverProps={ { position } } |
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 switch to placement
should happen in a separate PR (and requires exposing the positionToPlacement
utility from Popover
too)
Size Change: +138 B (0%) Total Size: 1.32 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.
It's good to see the position prop getting the deprecation treatment. Nice work, and thanks for the comprehensive PR description and testing instructions. 🙇
The code changes look good, and everything tested well for me when compared against trunk.
Click for testing results
✅ No typing errors and tests are passing
✅ Storybook example works and controls & docs updated
✅ Cover
✅ Image
✅ Inserter
✅ Tool selector
✅ PostTemplate Template Title
✅ Post Schedule
✅ Post URL
✅ Post Visibility
✅ Document Actions
✅ More Menu
✅ ImportDropdown
PS: I couldn't see where the TableOfContents
component was used either
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.
+1 thanks for the detailed testing instructions, made reviewing this one a breeze!
Code change looks good, and each of those cases are testing correctly for me, too, so LGTM ✨
PS: I couldn't see where the TableOfContents component was used either
As far as I can tell, the one usage of the component was removed back in this PR: #44788 that switched the document information and outline from being in a dropdown to being in an Outline tab next to the list view. I imagine that component has to stick around since it was exported, even though it's likely not being used anywhere?
Thank you both for the review, this was a tedious one 🙏 |
Closes #46858
What?
Deprecate the
position
prop for theDropdown
component:position
prop is about to be deprecated for thePopover
component (see Popover: refactor all usages of the legacyposition
prop to theplacement
prop #44401)popoverProps.placement
Following this logic, the
focusOnMount
prop should also be deprecated in favor of usingpopoverProps.focusOnMount
Why?
Cleaning up code, improving devX
How?
Testing Instructions
Tests pass (this means that no deprecation warnings are printed to console, which means that all usages of
Dropdown
have been migrated away from theposition
prop)Cover block
trunk
BlockNavigationDropdown
,BlockColorsStyleSelector
Not sure if there's a way to test this component as it's deprecated and seemingly not used anymore.
Image block
trunk
Inserter
trunk
Tool selector
trunk
PostTemplate Template title
trunk
trunk
Post schedule
trunk
Post URL
trunk
Post visibility
trunk
Document actions
trunk
TableOfContents
Not sure how to display this component
More menu
trunk
ImportDropdown
trunk
✍️ Dev Note
The dev note in #44391 also covers the changes from this PR.