refactor(css): remove duplicated rules and fix three destructive-butt… - #4
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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:
tint, file-chip icons, snippet block-spacing
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
paddingon .day-divider span, a duplicate.message { position: relative }, .composer-preview's restatement of .message-body,min-width: 0on .content inside a media query where the base rule already set it, repeatedcursor: pointeron 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 tobutton: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.