fix: harden CHRNX shell accessibility

This commit is contained in:
chrnx committed 2026-08-11 17:12:18 -05:00
1 parent f371db4cb5
commit e1579657d6
14 files changed
+520 -54

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/footer-content",
"version": "0.1.0",
"title": "CHRNX Footer Content",
"category": "theme",
"description": "Display translated internal footer navigation and site credit.",
"textdomain": "chrnx",
"supports": { "html": false },
"render": "file:./render.php"
}
+55
View File
@@ -0,0 +1,55 @@
<?php
/**
* Render translated footer navigation and site credit.
*
* @package CHRNX
*/
$chrnx_footer_links = array(
array(
'label' => __( 'Journal', 'chrnx' ),
'url' => home_url( '/journal/' ),
),
array(
'label' => __( 'Projects', 'chrnx' ),
'url' => home_url( '/projects/' ),
),
array(
'label' => __( 'Music', 'chrnx' ),
'url' => home_url( '/music/' ),
),
array(
'label' => __( 'Podcasts', 'chrnx' ),
'url' => home_url( '/podcasts/' ),
),
array(
'label' => __( 'About', 'chrnx' ),
'url' => home_url( '/about/' ),
),
);
$chrnx_site_name = get_bloginfo( 'name' );
$chrnx_copyright = sprintf(
/* translators: 1: current year, 2: site name. */
__( '© %1$s %2$s', 'chrnx' ),
wp_date( 'Y' ),
$chrnx_site_name
);
?>
<div
<?php
// WordPress escapes each generated wrapper attribute.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo get_block_wrapper_attributes( array( 'class' => 'chrnx-site-footer__inner' ) );
?>
>
<p class="chrnx-site-footer__site"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $chrnx_site_name ); ?></a></p>
<nav class="chrnx-footer-navigation" aria-label="<?php echo esc_attr__( 'Footer navigation', 'chrnx' ); ?>">
<ul>
<?php foreach ( $chrnx_footer_links as $chrnx_link ) : ?>
<li><a href="<?php echo esc_url( $chrnx_link['url'] ); ?>"><?php echo esc_html( $chrnx_link['label'] ); ?></a></li>
<?php endforeach; ?>
</ul>
</nav>
<p class="chrnx-site-footer__credit"><?php echo esc_html( $chrnx_copyright ); ?></p>
<p class="chrnx-site-footer__line"><?php echo esc_html__( 'Made in Sinaloa, shared from home.', 'chrnx' ); ?></p>
</div>
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/mobile-menu-toggle",
"version": "0.1.0",
"title": "CHRNX Mobile Menu Toggle",
"category": "theme",
"description": "Progressively reveal the primary navigation on small screens.",
"textdomain": "chrnx",
"supports": { "html": false },
"viewScript": "file:../../assets/js/navigation.js",
"render": "file:./render.php"
}
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* Render the progressive mobile navigation toggle.
*
* @package CHRNX
*/
$chrnx_open_label = __( 'Open primary navigation', 'chrnx' );
$chrnx_close_label = __( 'Close primary navigation', 'chrnx' );
?>
<button
<?php
// WordPress escapes each generated wrapper attribute.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo get_block_wrapper_attributes(
array(
'class' => 'chrnx-mobile-menu-toggle',
'data-chrnx-menu-toggle' => '',
)
);
?>
type="button"
hidden
aria-controls="chrnx-primary-navigation"
aria-expanded="false"
aria-label="<?php echo esc_attr( $chrnx_open_label ); ?>"
data-label-open="<?php echo esc_attr( $chrnx_open_label ); ?>"
data-label-close="<?php echo esc_attr( $chrnx_close_label ); ?>"
>
<span aria-hidden="true">☰</span>
</button>