feat: define compact CHRNX header controls

This commit is contained in:
chrnx committed 2026-08-11 19:36:53 -05:00
1 parent d9d45b3498
commit 3280970e3d
5 files changed
+100 -6

No files matched your search

+16
View File
@@ -6,8 +6,22 @@
*/
$chrnx_control_name = wp_unique_id( 'chrnx-theme-' );
$chrnx_panel_id = wp_unique_id( 'chrnx-theme-panel-' );
$chrnx_button_label = __( 'Choose color theme', 'chrnx' );
?>
<div class="chrnx-theme-control">
<button
type="button"
hidden
data-chrnx-theme-button
aria-controls="<?php echo esc_attr( $chrnx_panel_id ); ?>"
aria-expanded="false"
aria-label="<?php echo esc_attr( $chrnx_button_label ); ?>"
>
<span aria-hidden="true">◐</span>
</button>
<fieldset
id="<?php echo esc_attr( $chrnx_panel_id ); ?>"
<?php
// WordPress escapes each generated wrapper attribute.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -18,6 +32,7 @@ $chrnx_control_name = wp_unique_id( 'chrnx-theme-' );
)
);
?>
data-chrnx-theme-panel
data-status-light="<?php esc_attr_e( 'Light theme active', 'chrnx' ); ?>"
data-status-dark="<?php esc_attr_e( 'Dark theme active', 'chrnx' ); ?>"
data-status-system-light="<?php esc_attr_e( 'Light theme active, following system preference', 'chrnx' ); ?>"
@@ -30,3 +45,4 @@ $chrnx_control_name = wp_unique_id( 'chrnx-theme-' );
<output data-chrnx-theme-status aria-live="polite"><?php esc_html_e( 'Following system theme', 'chrnx' ); ?></output>
</fieldset>
<noscript><p class="chrnx-theme-noscript"><?php esc_html_e( 'Enable JavaScript to choose a color theme.', 'chrnx' ); ?></p></noscript>
</div>