fix: harden CHRNX shell accessibility
This commit is contained in:
14 files changed
+520
-54
No files matched your search
@@ -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"
|
||||
}
|
||||
@@ -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>
|
||||
Reference in new issue
Block a user