WP_Interactivity_API::print_router_loading_and_screen_reader_markup()publicWP 6.5.0

Outputs the markup for the top loading indicator and the screen reader notifications during client-side navigations.

This method prints a div element representing a loading bar visible during navigation, as well as an aria-live region that can be read by screen readers to announce navigation status.

Method of the class: WP_Interactivity_API{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Interactivity_API = new WP_Interactivity_API();
$WP_Interactivity_API->print_router_loading_and_screen_reader_markup();

Changelog

Since 6.5.0 Introduced.

WP_Interactivity_API::print_router_loading_and_screen_reader_markup() code WP 6.5.4

public function print_router_loading_and_screen_reader_markup() {
	echo <<<HTML
		<div
			class="wp-interactivity-router-loading-bar"
			data-wp-interactive="core/router"
			data-wp-class--start-animation="state.navigation.hasStarted"
			data-wp-class--finish-animation="state.navigation.hasFinished"
		></div>
		<div
			class="screen-reader-text"
			aria-live="polite"
			data-wp-interactive="core/router"
			data-wp-text="state.navigation.message"
		></div>
HTML;
}