feat: rebuild the header controls as icon buttons
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>
This commit is contained in:
16 files changed
+316
-156
No files matched your search
+84
-40
@@ -101,26 +101,64 @@ html[data-theme="light"] header.wp-block-template-part {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.chrnx-mobile-menu-toggle {
|
||||
/* One icon language in the header: no resting outline, chip on hover/focus. */
|
||||
.chrnx-mobile-menu-toggle,
|
||||
.chrnx-header-search button,
|
||||
.chrnx-theme-control > [data-chrnx-theme-button] {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 45px;
|
||||
min-height: 45px;
|
||||
padding: 0;
|
||||
border: 1px solid currentcolor;
|
||||
border: 0;
|
||||
border-radius: 0.35rem;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font-size: 1.4rem;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.chrnx-mobile-menu-toggle[hidden] {
|
||||
.chrnx-mobile-menu-toggle:hover,
|
||||
.chrnx-mobile-menu-toggle[aria-expanded="true"],
|
||||
.chrnx-header-search button:hover,
|
||||
.chrnx-theme-control > [data-chrnx-theme-button]:hover,
|
||||
.chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
|
||||
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
|
||||
color: var(--wp--preset--color--text);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
html[data-theme="light"] .chrnx-mobile-menu-toggle:hover,
|
||||
html[data-theme="light"] .chrnx-mobile-menu-toggle[aria-expanded="true"],
|
||||
html[data-theme="light"] .chrnx-header-search button:hover,
|
||||
html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button]:hover,
|
||||
html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
|
||||
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||
color: var(--wp--preset--color--ink);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
|
||||
:root:not([data-theme]) .chrnx-mobile-menu-toggle:hover,
|
||||
:root:not([data-theme]) .chrnx-mobile-menu-toggle[aria-expanded="true"],
|
||||
:root:not([data-theme]) .chrnx-header-search button:hover,
|
||||
:root:not([data-theme]) .chrnx-theme-control > [data-chrnx-theme-button]:hover,
|
||||
:root:not([data-theme]) .chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
|
||||
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||
color: var(--wp--preset--color--ink);
|
||||
}
|
||||
}
|
||||
|
||||
/* The shared rule above sets display, so hidden must win back explicitly. */
|
||||
.chrnx-mobile-menu-toggle[hidden],
|
||||
.chrnx-theme-control > [data-chrnx-theme-button][hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chrnx-primary-navigation a,
|
||||
.chrnx-footer-navigation a,
|
||||
.chrnx-header-search button,
|
||||
.chrnx-header-search input {
|
||||
min-width: 45px;
|
||||
min-height: 45px;
|
||||
@@ -155,18 +193,6 @@ html[data-theme="light"] header.wp-block-template-part {
|
||||
padding-inline: 0.75rem;
|
||||
}
|
||||
|
||||
.chrnx-header-search button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 0.75rem;
|
||||
border: 1px solid currentcolor;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chrnx-screen-reader-text {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
@@ -193,7 +219,7 @@ html[data-theme="light"] header.wp-block-template-part {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.chrnx-theme-toggle legend {
|
||||
.chrnx-theme-toggle__legend {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
@@ -205,29 +231,50 @@ html[data-theme="light"] header.wp-block-template-part {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.chrnx-theme-toggle label {
|
||||
/* No resting outline: the active choice reads as a filled chip instead. */
|
||||
.chrnx-theme-toggle [data-chrnx-theme-value] {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 45px;
|
||||
min-height: 45px;
|
||||
padding: 0 0.45rem;
|
||||
border: 1px solid transparent;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 0.35rem;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.chrnx-theme-toggle label:has(input:checked) {
|
||||
border-color: currentcolor;
|
||||
background: var(--wp--preset--color--panel);
|
||||
.chrnx-theme-toggle [data-chrnx-theme-value] svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
html[data-theme="light"] .chrnx-theme-toggle label:has(input:checked) {
|
||||
background: var(--wp--preset--color--surface);
|
||||
.chrnx-theme-toggle [data-chrnx-theme-value]:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.chrnx-theme-toggle input {
|
||||
accent-color: var(--wp--preset--color--green);
|
||||
/* Quiet chip, full-contrast label: accent-on-accent fails WCAG AA. */
|
||||
.chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
|
||||
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
|
||||
color: var(--wp--preset--color--text);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
html[data-theme="light"] .chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
|
||||
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||
color: var(--wp--preset--color--ink);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
|
||||
:root:not([data-theme]) .chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
|
||||
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||
color: var(--wp--preset--color--ink);
|
||||
}
|
||||
}
|
||||
|
||||
.js .chrnx-header-search[data-expanded="false"] input {
|
||||
@@ -407,16 +454,8 @@ html[data-theme="light"] footer.wp-block-template-part {
|
||||
}
|
||||
|
||||
.chrnx-theme-control > [data-chrnx-theme-button] {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
padding: 0;
|
||||
border: 1px solid currentcolor;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chrnx-navigation-enhanced .chrnx-theme-control > [data-chrnx-theme-button] {
|
||||
@@ -441,20 +480,25 @@ html[data-theme="light"] footer.wp-block-template-part {
|
||||
min-width: 0;
|
||||
height: auto;
|
||||
padding: 0.5rem;
|
||||
border: 1px solid currentcolor;
|
||||
border: 1px solid color-mix(in srgb, currentcolor 18%, transparent);
|
||||
border-radius: 0.35rem;
|
||||
background: var(--wp--preset--color--panel);
|
||||
color: inherit;
|
||||
box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 28%);
|
||||
}
|
||||
|
||||
html[data-theme="light"].chrnx-navigation-enhanced .chrnx-theme-toggle {
|
||||
background: var(--wp--preset--color--surface);
|
||||
}
|
||||
|
||||
.chrnx-navigation-enhanced .chrnx-theme-toggle label {
|
||||
/*
|
||||
* 45px, not 44: a floor set exactly at the WCAG minimum rounds to
|
||||
* 43.99997px in Firefox and fails the target-size check.
|
||||
*/
|
||||
.chrnx-navigation-enhanced .chrnx-theme-toggle [data-chrnx-theme-value] {
|
||||
flex: 1 1 auto;
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
min-width: 45px;
|
||||
min-height: 45px;
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user