From 25321bdac5c089ed199485ed16f2193e2ba5c5f4 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 11 Jul 2022 16:35:46 +0300 Subject: [PATCH 1/4] [Components - Popover]: Fix regression of inbetween inserter in site editor --- packages/components/src/popover/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/components/src/popover/index.js b/packages/components/src/popover/index.js index 909011753ac7d..e93442a70f1b2 100644 --- a/packages/components/src/popover/index.js +++ b/packages/components/src/popover/index.js @@ -148,7 +148,7 @@ const Popover = ( return anchorRef.ownerDocument; } else if ( anchorRect && anchorRect?.ownerDocument ) { return anchorRect.ownerDocument; - } else if ( getAnchorRect && anchorRefFallback.current ) { + } else if ( getAnchorRect ) { return ( getAnchorRect( anchorRefFallback.current )?.ownerDocument ?? document @@ -275,7 +275,7 @@ const Popover = ( return anchorRect; }, }; - } else if ( getAnchorRect && anchorRefFallback.current ) { + } else if ( getAnchorRect ) { usedRef = { getBoundingClientRect() { const rect = getAnchorRect( anchorRefFallback.current ); From 6bc10e5cbfb3c0d99ecb676cfb084c42451757d0 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 11 Jul 2022 16:39:32 +0300 Subject: [PATCH 2/4] add changelog entry --- packages/components/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 370730aaba465..aee106e274157 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -6,8 +6,9 @@ - `BoxControl`: Change ARIA role from `region` to `group` to avoid unwanted ARIA landmark regions ([#42094](https://github.com/WordPress/gutenberg/pull/42094)). - `FocalPointPicker`, `FormTokenField`, `ResizableBox`: Fixed SSR breakage ([#42248](https://github.com/WordPress/gutenberg/pull/42248)). -- `Popover`: pass missing anchor ref to the `getAnchorRect` callback prop. ([#42076](https://github.com/WordPress/gutenberg/pull/42076)) - `ComboboxControl`: use custom prefix when generating the instanceId ([#42134](https://github.com/WordPress/gutenberg/pull/42134). +- `Popover`: pass missing anchor ref to the `getAnchorRect` callback prop. ([#42076](https://github.com/WordPress/gutenberg/pull/42076)). +- `Popover`: call `getAnchorRect` callback prop even if `anchorRefFallback` has not a value. ([#42329](https://github.com/WordPress/gutenberg/pull/42329)). ### Internal From bf58a3582001017daafec0d1a58af9844d19ac90 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Tue, 12 Jul 2022 10:11:04 +0300 Subject: [PATCH 3/4] update readme --- packages/components/src/popover/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/components/src/popover/README.md b/packages/components/src/popover/README.md index 3e8a5e2cf2855..d0d96359fdb2f 100644 --- a/packages/components/src/popover/README.md +++ b/packages/components/src/popover/README.md @@ -61,7 +61,7 @@ Set this prop to `false` to disable focus changing entirely. This should only be ### placement -The direction in which the popover should open relative to its parent node or anchor node. +The direction in which the popover should open relative to its parent node or anchor node. The available base placements are 'top', 'right', 'bottom', 'left'. @@ -137,7 +137,7 @@ A callback function which is used to override the anchor value computation algor If you need the `DOMRect` object i.e., the position of popover to be calculated on every time, the popover re-renders, then use `getAnchorRect`. -`getAnchorRect` callback function receives a reference to the popover anchor element as a function parameter and it should return a `DOMRect` object. +`getAnchorRect` callback function receives a reference to the popover anchor element as a function parameter and it should return a `DOMRect` object. Noting that `getAnchorRect` can be called with `null`. - Type: `Function` - Required: No From 4f85653c965ba659af05fb0c612ae84cb19cb2ff Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Tue, 12 Jul 2022 10:12:03 +0300 Subject: [PATCH 4/4] update changelog --- packages/components/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index aee106e274157..75606c09b244c 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -8,7 +8,7 @@ - `FocalPointPicker`, `FormTokenField`, `ResizableBox`: Fixed SSR breakage ([#42248](https://github.com/WordPress/gutenberg/pull/42248)). - `ComboboxControl`: use custom prefix when generating the instanceId ([#42134](https://github.com/WordPress/gutenberg/pull/42134). - `Popover`: pass missing anchor ref to the `getAnchorRect` callback prop. ([#42076](https://github.com/WordPress/gutenberg/pull/42076)). -- `Popover`: call `getAnchorRect` callback prop even if `anchorRefFallback` has not a value. ([#42329](https://github.com/WordPress/gutenberg/pull/42329)). +- `Popover`: call `getAnchorRect` callback prop even if `anchorRefFallback` has no value. ([#42329](https://github.com/WordPress/gutenberg/pull/42329)). ### Internal