Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move loaded data state out of texts object
  • Loading branch information
sirreal committed Sep 17, 2024
commit 63a1ffa83d8643287a621885193192b9fa57fbe9
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