Skip to content

refactor(css): remove duplicated rules and fix three destructive-butt… - #4

Merged
olavgg merged 1 commit into
mainfrom
refactor/css-dedupe
Aug 8, 2026
Merged

refactor(css): remove duplicated rules and fix three destructive-butt…#4
olavgg merged 1 commit into
mainfrom
refactor/css-dedupe

Conversation

@olavgg

@olavgg olavgg commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

…on hovers

app.css had accumulated rules written twice: sibling components with byte-identical declaration blocks, and one full second copy of every theme palette. Deduped without changing what renders — verified by diffing the flattened rule set (every selector expanded out of its selector list, declarations compared as a set) against HEAD, and by hand-checking cascade order wherever equal-specificity rules compete.

Merged, one skin instead of N copies:

  • Archive / Leave / Delete-forever: 6 blocks that existed three times
  • Sidebar rows: .channel-list and .dm-list shared hover, active, unread, muted and name truncation — six blocks that existed twice
  • Search dropdown and /search results: the "not joined" pill, the
    tint, file-chip icons, snippet block-spacing
  • .profile-content/.admin-content, the poll/about modal backdrops, .logo-mark, .send-icon sizing, the ADMIN role pill

Theme swatches now read the theme's own tokens. The swatch element carries that theme's data-theme and the [data-theme] blocks are attribute-only selectors, so it already resolves the right values; the 60 hardcoded hex codes were a second copy of every palette — two places to change a colour and one place to forget. A theme added to the picker now gets a correct swatch for free. All 60 stripes verified to resolve to the colour they did before.

Removed as dead: a second padding on .day-divider span, a duplicate .message { position: relative }, .composer-preview's restatement of .message-body, min-width: 0 on .content inside a media query where the base rule already set it, repeated cursor: pointer on emoji-picker hovers, and a comment paragraph printed twice.

Three var() references to custom properties that have never existed (--hover-bg, --surface, --text-muted) always rendered their fallback. Collapsed to that value so the code says what it does, with a comment naming the real token; the colours are unchanged.

Fixes: archive, admin-danger and call-end buttons lost their colour on hover. Each declared only filter: brightness(), so the background fell through to button:hover (0,1,1) or .call-btn:hover (0,2,0), which out-specify a single class — the two red buttons pressed in a hurry (decline, hang up) and Suspend/Clear messages repainted accent blue or a neutral tint. .channel-leave-danger and .channel-destroy-danger already restated their own background inside :hover; the same fix was applied twice and missed three times, which is the drift the duplication hid.

…on hovers

app.css had accumulated rules written twice: sibling components with
byte-identical declaration blocks, and one full second copy of every
theme palette. Deduped without changing what renders — verified by
diffing the flattened rule set (every selector expanded out of its
selector list, declarations compared as a set) against HEAD, and by
hand-checking cascade order wherever equal-specificity rules compete.

Merged, one skin instead of N copies:
- Archive / Leave / Delete-forever: 6 blocks that existed three times
- Sidebar rows: .channel-list and .dm-list shared hover, active, unread,
  muted and name truncation — six blocks that existed twice
- Search dropdown and /search results: the "not joined" pill, the <mark>
  tint, file-chip icons, snippet block-spacing
- .profile-content/.admin-content, the poll/about modal backdrops,
  .logo-mark, .send-icon sizing, the ADMIN role pill

Theme swatches now read the theme's own tokens. The swatch element
carries that theme's data-theme and the [data-theme] blocks are
attribute-only selectors, so it already resolves the right values; the
60 hardcoded hex codes were a second copy of every palette — two places
to change a colour and one place to forget. A theme added to the picker
now gets a correct swatch for free. All 60 stripes verified to resolve
to the colour they did before.

Removed as dead: a second `padding` on .day-divider span, a duplicate
`.message { position: relative }`, .composer-preview's restatement of
.message-body, `min-width: 0` on .content inside a media query where the
base rule already set it, repeated `cursor: pointer` on emoji-picker
hovers, and a comment paragraph printed twice.

Three var() references to custom properties that have never existed
(--hover-bg, --surface, --text-muted) always rendered their fallback.
Collapsed to that value so the code says what it does, with a comment
naming the real token; the colours are unchanged.

Fixes: archive, admin-danger and call-end buttons lost their colour on
hover. Each declared only `filter: brightness()`, so the background fell
through to `button:hover` (0,1,1) or `.call-btn:hover` (0,2,0), which
out-specify a single class — the two red buttons pressed in a hurry
(decline, hang up) and Suspend/Clear messages repainted accent blue or a
neutral tint. .channel-leave-danger and .channel-destroy-danger already
restated their own background inside :hover; the same fix was applied
twice and missed three times, which is the drift the duplication hid.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@olavgg
olavgg merged commit acf8045 into main Aug 8, 2026
1 check passed
@olavgg
olavgg deleted the refactor/css-dedupe branch August 8, 2026 18:40
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