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:
PopovercomponentBreaking ChangestoDeprecations@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
Popovercomponent which aimed at addressing a spike of regressions happened recently, mostly tracked in #42770The
Popovercomponent from the@wordpress/componentspackage 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:placementprop has been introduced. This prop is meant to replace the legacypositionprop (which will be marked as deprecated in the near future)anchorprop 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__unstableForcePositionprop has been marked as deprecated, in favour of newflipandresizeprops. The__unstableForcePositionis currently scheduled for removal in WordPress 6.3__unstableShiftprop has been marked as deprecated, in favour of theshiftprop. The__unstableShiftis currently scheduled for removal in WordPress 6.3__unstableObserveElementprop has been removed, since it's not necessary anymore after the recent updates to thePopoverFor more details, see the updated component's README and the Storybook examples.
The changes to the
Popovercomponent also affected the@wordpress/rich-text, where a newuseAnchorhook was introduced. The previoususeAnchorRefhook 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