Skip to content

Drop the stylesheet rules nothing can reach - #373

Merged
isc merged 1 commit into
mainfrom
css-drop-shadowed-rules
Sep 14, 2026
Merged

isc merged 1 commit into
mainfrom
css-drop-shadowed-rules

Conversation

@isc

@isc isc commented Sep 11, 2026

Copy link
Copy Markdown
Owner

A sweep of public/styles.css for rules that are dead or that
contradict themselves. 49 declarations out, 2241 → 2205 lines, and
nothing moves on screen.

Every class named in the file is written somewhere in the markup (the
pt-pill--* are built by string concatenation, measure-number is
emitted on the score), so there was no dead class to find. What was
left is subtler: rules whose combination never occurs, and
declarations that a later rule always undoes.

What went

Rule Why nothing could reach it
.pt-popover select, label, label input[type=checkbox], small The ⚙️ menu holds links, buttons, an <hr>, an <h4> and the FR/EN pill. Those controls moved to the data page and left their rules behind.
.pt-popover button (9 declarations) The only bare buttons in the menu are FR/EN, and .pt-langswitch button — equal weight, further down the file — restates every one of its declarations.
.pt-topbar input The topbar exists only on score.html and carries a <select> (the part navigator). Checked on a Hanon collection too, where that select is shown: no input.
Half of .pt-bpm-field (11 declarations) The tempo field only ever appears as a direct child of .pt-band-controls, which sizes and aligns it. Width, padding, border, background, colour and height were set and replaced two rules later.
line-height: 28px on the band's BPM input Under border-box, with a 1px border and 4px of padding on a 28px box, the content box is 18px. The line could not apply.

Two rules with the same selector (.pt-modebar > .pt-action-button,
written twice in a row) are now one.

Two traps, both caught by measuring

border: none on .pt-band-controls .pt-bpm-field looked like the
component's border being undone. It is not: it outweighs the cluster's
> * + * divider, which the field is the one item not to take.
Removing it shifted the whole band 1px and showed up in the captures
immediately. It is back, with a comment saying what it is for.

Re-scoping .pt-popover button:hover to
.pt-popover .pt-langswitch button:hover took it from (0,2,1) to
(0,3,1) — enough to start beating .pt-langswitch button[aria-pressed],
so the language in use would have greyed out under the pointer:
white text on rgb(241,243,247). Measured, confirmed, and prevented
with :not([aria-pressed="true"]).

How "nothing changed" was checked

26 states captured before and after with Playwright — the seven pages,
phone and desktop, the changelog and feedback modals, the ⚙️ menu, all
four bands, the journal, the calendar, the score in each mode. Compared
pixel by pixel with ImageMagick.

  • before vs after: 1 shot differs by 1 pixel.
  • noise floor (two captures of the same code): 3 shots, up to 12
    pixels — colour-emoji rasterisation varies between runs.

The diff is below the floor. Hover, which no screenshot sees, is
compared through computed styles instead: the pill at rest and hovered,
in both states, the menu rows, before and after.

Left standing, deliberately

.pt-bpm-field__step is 34px inside a 32px content box with
overflow: hidden, so 2px of its hover tint and rounded corners are
clipped — and the ::after that grows its touch target is clipped with
them. It is exactly the line-height case, except the ≤600px block
makes 34px right there, so it is wrong by 2px on desktop rather than
inert. Fixing it moves pixels, which this change is not for.

🤖 Generated with Claude Code

A sweep of styles.css for rules that are dead or that contradict
themselves. Every class in the file is written somewhere, so what was
left was rules whose *combination* never occurs, and declarations a
later rule always undoes.

The ⚙️ menu holds links, buttons, an <hr>, an <h4> and the FR/EN pill,
and nothing else: the rules for a select, a label, its checkbox and a
<small> had no element left to match since those controls moved to the
data page. The generic `.pt-popover button` went too — the only bare
buttons in the menu are the language pair, and `.pt-langswitch button`,
at equal weight and further down the file, restates every one of its
declarations. Its hover was the exception, being the tint the pill
actually uses, so it is kept and says who it is for.

`.pt-topbar input` never matched: the topbar carries a <select>, the
part navigator, and no input on any page.

The tempo field was written twice, and the second half undid the first:
it only ever appears as a direct child of a band cluster, which sizes
and aligns it, so its width, padding, border, background, colour and
height were set and then replaced two rules later. It now has one
definition. `line-height: 28px` on its input went with them — under
border-box, with a 1px border and 4px of padding, the content box is
18px and the line could not apply.

Nothing moves on screen: 26 states (every page, phone and desktop, the
modals, the menu, the four bands, the journal, the calendar) captured
before and after, and the one pixel that differs is under the noise two
captures of the same code produce. Hover, which a screenshot does not
see, is compared through the computed styles instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Preview supprimée (PR fermée). L'URL n'est plus accessible.

@isc
isc merged commit 9efbdae into main Sep 14, 2026
6 checks passed
@isc
isc deleted the css-drop-shadowed-rules branch September 14, 2026 15:21
isc added a commit that referenced this pull request Sep 14, 2026
The buttons named `height: 34px` — the band's *outer* height. Inside its
1px border there are 32, and the cluster clips what overflows: a pixel
top and bottom went under `overflow: hidden`, taking the top of their
4px corners and of the tint they take under a pointer, which ran flush
into the band's rules instead of stopping short of them.

They now take the line by stretching, the way every direct child of the
cluster does — which is also why nothing moves at phone width, where the
line is 34px and that is what they get.

Found by measuring rather than by eye, in the sweep behind #373, and the
last of that family: the same mistake put the progression picker 2px
high (#369) and a line-height on an input whose content box was 18px.

The thumb target is unchanged and still short: `overflow: hidden` clips
the pseudo-element that grows it, hit testing included, so it is 44 wide
and the band's 32 tall. Growing it needs a taller band or a cluster that
does not clip — its own change, and a visible one.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant