fix(site): hide the secondary download button on non-Linux visitors - #18
Merged
Conversation
It rendered as an empty 55x31 box for everyone on Mac and Windows.
The `hidden` attribute hides an element through a UA-stylesheet
`display: none`, which any author rule that sets `display` silently beats.
`.btn` sets `display: inline-flex`, so `hidden` did nothing to it. The
`#dl-others` paragraph next to it hides correctly only because `.dl-meta`
happens never to set `display` — which is why this was not caught by
testing the neighbouring element.
Fixed with a global `[hidden] { display: none !important; }` rather than a
targeted `.btn[hidden]`: the next element given `hidden` will hit this the
moment it also has a `display`, and that is not a bug worth finding twice.
Verified both states in a browser: hidden collapses to 0x0 with
`display: none`, and unhidden still renders as a full 304x58 button, so the
Linux path is unaffected.
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.
The bug
#dl-secondaryrendered as an empty 55×31 box for every Mac and Windows visitor. Live on the site right now — introduced by #17.Cause
The
hiddenattribute hides an element via adisplay: nonein the UA stylesheet, which any author rule settingdisplayoverrides..btnsetsdisplay: inline-flex, sohiddenhad no effect on it.Confirmed on the live page before fixing:
Worth noting why it slipped through: the
#dl-othersparagraph directly beside it useshiddencorrectly, because.dl-metahappens never to setdisplay. Testing the neighbour would not have caught this.Fix
Global rather than a targeted
.btn[hidden]— the next element givenhiddenhits this the moment it also has adisplay, and that is not a bug worth discovering twice.Verification
Both states checked in a browser:
display: none, 0×0So non-Linux visitors get nothing, and the Linux path is unaffected.