Skip to content

Remove invalid CSS and the dead btnform block from forms.scss - #792

Merged
amjjbonvin merged 2 commits into
masterfrom
chore/forms-scss-cleanup
Sep 30, 2026
Merged

amjjbonvin merged 2 commits into
masterfrom
chore/forms-scss-cleanup

Conversation

@amjjbonvin

Copy link
Copy Markdown
Member

Split out of #791 on review feedback — this is unrelated to that PR's CSS
pipeline fix and deserves its own review. It cherry-picked onto master cleanly,
confirming the two are independent.

Two changes, both to _sass/forms.scss

1. Three invalid declarations deleted

The file carried three declarations of the form margin-bottom: 5px / 2. Sass
never evaluated these
— two literals with no parentheses emit the slash
verbatim, so the compiled CSS shipped margin-bottom:5px/2, which is invalid and
silently discarded by browsers.

They are deleted rather than converted to math.div(), because converting would
newly apply margins that have never been in effect. Nothing designed for the
values involved: 2.5px, 1.25px and 1.25px are artifacts of hardcoding numbers into
what was presumably variable arithmetic upstream.

Reach of each, measured against the built site:

Declaration Reach
btnform p dead — see below
label dead — the site has no <label> element at all, nor any <textarea> or <select>
input, textarea, select 47 <input> elements, all on one legacy page (/software/haddock2.2/start_new/)

For the third, deleting preserves current rendering exactly: the invalid value
already resolved to no margin, so removing it changes nothing.

2. The dead btnform { ... } block deleted

Line 3 read btnform { — a bare element selector for <btnform>, which is not an
HTML element and appears zero times in the site's markup. That made 30 lines of
form styling dead code, including the first invalid declaration above.

Renaming it to form was considered and rejected. On the one page that has
forms, every nested rule would still match nothing — no fieldset, legend, p
or ul elements inside those forms, and all four <br> sit before the first
<form> tag. Renaming would activate only a 5px margin on three legacy forms,
while leaving form br { display: none } primed to silently hide line breaks in
any form added later.

Also drops the unused @use "sass:math" — the file uses only color.*. It was
left behind by a reverted change in #789.

Verification

  • No invalid px/N values remain in the compiled CSS
  • 0 HTML pages changed
  • The only selectors removed are the six btnform* ones, all confirmed unmatched
  • label and input,textarea,select keep every other declaration:
- label{display:block;margin-bottom:10px/8;font-weight:bold;color:#333332;cursor:pointer}
+ label{display:block;font-weight:bold;color:#333332;cursor:pointer}

Note on ordering: master currently serves the committed main_pretty.css, so
this change has zero live effect until #791 lands — verified, main_pretty.css
builds byte-identical here. The two PRs are safe to merge in either order.

Not addressed here

The same rule block sets width: 100% on inputs, which overrides the size=3 /
size=60 attributes on that legacy HADDOCK 2.2 form. Left alone — it is
long-standing behaviour and a separate question.

🤖 Generated with Claude Code

forms.scss carried three declarations of the form `margin-bottom: 5px / 2`.
Sass never evaluated them: two literals with no parentheses emit the slash
verbatim, so the compiled CSS shipped `margin-bottom:5px/2`, which is invalid
and silently discarded by browsers.

Rather than convert them to math.div(), which would newly apply margins that
have never been in effect, they are deleted. Nothing designed for the values
involved -- 2.5px, 1.25px and 1.25px are artifacts of hardcoding numbers into
what was presumably variable arithmetic upstream.

Reach of each, measured against the built site:

  btnform p      dead -- see below
  label          dead -- the site has no <label> element at all, nor any
                  <textarea> or <select>
  input, ...     47 <input> elements, all on one legacy page
                  (/software/haddock2.2/start_new/). Deleting preserves current
                  rendering exactly, since the invalid value already resolved
                  to no margin.

Also delete the whole `btnform { ... }` block. Line 3 read `btnform {` -- a bare
element selector for <btnform>, which is not an HTML element and appears zero
times in the site's markup. That made 30 lines of form styling dead, including
the first invalid declaration.

Renaming it to `form` was considered and rejected. On the one page that has
forms, every nested rule would still match nothing: there are no fieldset,
legend, p or ul elements inside those forms, and all four <br> sit before the
first <form> tag. It would activate only a 5px margin on three legacy forms,
while leaving `form br { display: none }` to silently hide line breaks in any
form added later.

Drop the unused `@use "sass:math"` while here; the file uses only color.*.

Verified: no invalid px/N values remain in the compiled CSS, no HTML page
changed, and the only selectors removed are the six btnform ones. The label and
input rules keep every other declaration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@amjjbonvin
amjjbonvin merged commit 8cd77fc into master Sep 30, 2026
2 checks passed
@amjjbonvin
amjjbonvin deleted the chore/forms-scss-cleanup branch September 30, 2026 06:36
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