The theme switch was three labelled radios that wrapped the header onto a second line with long translations. It is three SVG buttons now, with search and menu sharing the same language: no resting outline, a filled chip for the active choice. Radios gave arrow-key roving for free, so the group reimplements it rather than losing it. The first chip colour put accent on accent and failed WCAG AA; the label carries full contrast instead. Mobile targets sit at 45px because a floor of exactly 44 rounds to 43.99997 in Firefox. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
38 lines
2.0 KiB
PHP
38 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Render translated primary navigation and progressive site search.
|
|
*
|
|
* @package CHRNX
|
|
*/
|
|
|
|
$chrnx_header_links = chrnx_get_navigation_links( 'chrnx-primary' );
|
|
$chrnx_search_label = __( 'Search', 'chrnx' );
|
|
$chrnx_search_id = wp_unique_id( 'chrnx-search-' );
|
|
$chrnx_search_panel_id = wp_unique_id( 'chrnx-search-panel-' );
|
|
$chrnx_current_url = chrnx_get_current_navigation_destination();
|
|
?>
|
|
<nav id="chrnx-primary-navigation" class="chrnx-primary-navigation" aria-label="<?php echo esc_attr__( 'Primary navigation', 'chrnx' ); ?>">
|
|
<ul>
|
|
<?php foreach ( $chrnx_header_links as $chrnx_link ) : ?>
|
|
<li><a href="<?php echo esc_url( $chrnx_link['url'] ); ?>"<?php echo $chrnx_current_url === $chrnx_link['url'] ? ' aria-current="page"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Fixed attribute fragment. ?>><?php echo esc_html( $chrnx_link['label'] ); ?></a></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</nav>
|
|
<form class="chrnx-header-search" role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" data-chrnx-search data-expanded="true">
|
|
<div id="<?php echo esc_attr( $chrnx_search_panel_id ); ?>" class="chrnx-header-search-row" data-chrnx-search-panel>
|
|
<label class="chrnx-screen-reader-text" for="<?php echo esc_attr( $chrnx_search_id ); ?>"><?php echo esc_html( $chrnx_search_label ); ?></label>
|
|
<input id="<?php echo esc_attr( $chrnx_search_id ); ?>" type="search" name="s" autocomplete="off">
|
|
</div>
|
|
<button
|
|
type="submit"
|
|
data-chrnx-search-button
|
|
aria-controls="<?php echo esc_attr( $chrnx_search_panel_id ); ?>"
|
|
aria-expanded="true"
|
|
data-label-open="<?php echo esc_attr__( 'Open search', 'chrnx' ); ?>"
|
|
data-label-submit="<?php echo esc_attr( $chrnx_search_label ); ?>"
|
|
>
|
|
<?php echo chrnx_get_icon_markup( 'search' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns a fixed literal SVG. ?>
|
|
<span class="chrnx-screen-reader-text"><?php echo esc_html( $chrnx_search_label ); ?></span>
|
|
</button>
|
|
</form>
|