Correctly attribute focus back when opening the mini cart several times (#47683)
* allow focusedOnMount element to be reset * Add changefile(s) from automation for the following project(s): woocommerce-blocks --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
8140a1d9c7
commit
d2ac6ff953
|
@ -26,11 +26,6 @@ export function useFocusReturn(
|
||||||
// Set ref to be used when unmounting.
|
// Set ref to be used when unmounting.
|
||||||
ref.current = node;
|
ref.current = node;
|
||||||
|
|
||||||
// Only set when the node mounts.
|
|
||||||
if ( focusedBeforeMount.current ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
focusedBeforeMount.current = node.ownerDocument.activeElement;
|
focusedBeforeMount.current = node.ownerDocument.activeElement;
|
||||||
} else if ( focusedBeforeMount.current ) {
|
} else if ( focusedBeforeMount.current ) {
|
||||||
const isFocused = ref.current?.contains(
|
const isFocused = ref.current?.contains(
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
Comment: This PR is a follow up to https://github.com/woocommerce/woocommerce/pull/47470
|
||||||
|
|
Loading…
Reference in New Issue