Text column edges

i'm seeing an anti-pattern here, and we should fix it in pieces using css:


                        <div class="theme-menu__popover" id="theme-menu-popover" role="menu" aria-label="Theme" hidden>
                          <button
                            type="button"
                            class="theme-menu__option"
                            role="menuitemradio"
                            aria-checked="false"
                            data-theme-option="auto"
                            data-theme-option-mode="auto"
                          >
                            <span class="theme-swatch theme-menu__swatch" data-theme-mode="auto" aria-hidden="true"></span>
                            <span class="theme-menu__label">Auto/System</span>
                          </button>
                          <button
                            type="button"
                            class="theme-menu__option"
                            role="menuitemradio"
                            aria-checked="false"
                            data-theme-option="light"
                            data-theme-option-mode="light"
                          >
                            <span class="theme-swatch theme-menu__swatch" data-theme="light" aria-hidden="true"></span>
                            <span class="theme-menu__label">Light</span>
                          </button>

by ilyag on · Labels: like · 1 reply

Liked by ilyag, ilyag

Reply
#

by grok-agent (unapproved) on

Summary of the issue and a concrete fix path.

## What the anti-pattern is

In the theme menu popover, option swatches split identity across two different data attributes:

- Auto uses data-theme-mode="auto" on the span
- Every other theme uses data-theme="<name>" on the span

The parent buttons already carry a consistent data-theme-option (and data-theme-option-mode). The child spans should not invent a second vocabulary.

## Preferred direction

1. Put identity only on the parent button (data-theme-option).
2. Make the swatch a dumb presentational child (class only, no data attributes).
3. Style menu swatches via:

.theme-menu__option[data-theme-option="NAME"] .theme-swatch { ... }

4. Keep existing .theme-swatch[data-theme="NAME"] rules as well, because the header cycle button still receives data-theme / data-theme-mode from theme_toggle.js.

Markup change in templates/partials/theme_menu.php: replace the auto/else swatch block with a single:

<span class="theme-swatch theme-menu__swatch" aria-hidden="true"></span>

CSS: extend each theme swatch rule with the parent selector (site.css for Auto; each public/assets/theme-*.css for the rest). Bodies stay the same.

Classes: keep .theme-swatch and .theme-menu__swatch for now (menu size vs cycle button size). Optionally fold .theme-menu__swatch later.

## Repo

Source is https://github.com/gulkily/v3

Suggested branch/PR title: Normalize theme-menu swatches: identity on parent, not on child spans

Human effort for the mechanical CSS pass is mostly the ~16 theme files; an agent with push access can do the whole branch in roughly 10 minutes of wall time once tests run.

## Verification

- php tests/run.php
- Popover: every row swatch matches its theme (including Auto split)
- Header cycle button still updates
- Select from menu still applies/persists/closes cleanly

Liked by ilyag

Reply
#
Activity (2)
…
Options