Popover: write better docs regarding the recent API changes #44195
+10
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Following up from #43691 (comment), this PR:
Popover
componentBreaking Changes
toDeprecations
@mirka I'm not sure what to do with the deprecations.md file — it looks like it hasn't been updated in some time
Dev note
Note: this dev note is a collective dev note for the recent changes to the
Popover
component which aimed at addressing a spike of regressions happened recently, mostly tracked in #42770The
Popover
component from the@wordpress/components
package has been mostly rewritten, in an effort to make it more stable, more reliable and more performant. While doing so, one of the main goals was to avoid introducing breaking changes. Here is the list with the main API changes:placement
prop has been introduced. This prop is meant to replace the legacyposition
prop (which will be marked as deprecated in the near future)anchor
prop has been introduced. This prop is meant to replace all previous anchor-related props (anchorRef
,anchorRect
,getAnchorRect
). These older anchor-related props are now marked as deprecated and are scheduled to be removed in WordPress 6.3__unstableForcePosition
prop has been marked as deprecated, in favour of newflip
andresize
props. The__unstableForcePosition
is currently scheduled for removal in WordPress 6.3__unstableShift
prop has been marked as deprecated, in favour of theshift
prop. The__unstableShift
is currently scheduled for removal in WordPress 6.3__unstableObserveElement
prop has been removed, since it's not necessary anymore after the recent updates to thePopover
For more details, see the updated component's README and the Storybook examples.
The changes to the
Popover
component also affected the@wordpress/rich-text
, where a newuseAnchor
hook was introduced. The previoususeAnchorRef
hook has been marked as deprecated, and is scheduled to be removed in WordPress 6.3.Why?
The recent changes won't cause any breakage (apart from deprecation warnings in dev mode), and therefore should not be flagged as such.
We will flag correctly the breaking changes in future versions of Gutenberg, when we will delete those deprecated props.
How?
Editing the docs