Skip to content

Commit

Permalink
Move loaded data state out of texts object
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Sep 17, 2024
1 parent 72f9503 commit 7768392
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/interactivity-router/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ const isValidEvent = ( event: MouseEvent ) =>
// Variable to store the current navigation.
let navigatingTo = '';

let hasLoadedNavigationTextsData = false;
const navigationTexts = {
loadedFromServer: false,
loading: 'Loading page, please wait.',
loaded: 'Page Loaded.',
};
Expand Down Expand Up @@ -367,8 +367,8 @@ export const { state, actions } = store( 'core/router', {
* @param messageKey The message to be announced by assistive technologies.
*/
function a11yAnnounce( messageKey: 'loading' | 'loaded' ) {
if ( ! navigationTexts.loadedFromServer ) {
navigationTexts.loadedFromServer = true;
if ( ! hasLoadedNavigationTextsData ) {
hasLoadedNavigationTextsData = true;
const content = document.getElementById(
'wp-script-module-data-@wordpress/interactivity-router'
)?.textContent;
Expand Down

0 comments on commit 7768392

Please sign in to comment.