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:
Seghir Nadir 2024-05-22 17:03:22 +02:00 committed by GitHub
parent 8140a1d9c7
commit d2ac6ff953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View File

@ -26,11 +26,6 @@ export function useFocusReturn(
// Set ref to be used when unmounting.
ref.current = node;
// Only set when the node mounts.
if ( focusedBeforeMount.current ) {
return;
}
focusedBeforeMount.current = node.ownerDocument.activeElement;
} else if ( focusedBeforeMount.current ) {
const isFocused = ref.current?.contains(

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Comment: This PR is a follow up to https://github.com/woocommerce/woocommerce/pull/47470