fix: [#2379] HTMLElement.hidden reflects the enumerated until-found state - #2380
Open
marciomazza wants to merge 1 commit into
Open
fix: [#2379] HTMLElement.hidden reflects the enumerated until-found state#2380marciomazza wants to merge 1 commit into
HTMLElement.hidden reflects the enumerated until-found state#2380marciomazza wants to merge 1 commit into
Conversation
…te, not just boolean presence
marciomazza
force-pushed
the
fix/hidden-until-found
branch
from
September 8, 2026 13:42
f243dfd to
53d5531
Compare
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.
Description
Resolves #2379
HTMLElement.hiddenmodels thehiddenattribute as a strict boolean, but it is an enumeratedattribute since hidden-until-found landed in HTML. An element with
hidden="until-found"readsback as
true, and assigning'until-found'writeshidden=""— theuntil-foundstate isinvisible and unsettable through the property.
Root cause: the getter returns
getAttribute('hidden') !== nulland the setter only branches ontruthiness, so it never distinguishes the
until-foundkeyword.Fix: the getter/setter type becomes
boolean | string; the getter returns'until-found'whenthe attribute's value is that keyword (ASCII case-insensitive),
truefor any other value,falsewhen absent; the setter writeshidden="until-found"for that keyword,hidden=""forother truthy values, and removes the attribute for falsy ones.
Deliberate:
el.hidden = undefinedremoves the attribute rather than writing""(outside thedeclared type anyway); the keyword check uses
toLowerCase(), not strict ASCII case-folding, tomatch the repo's convention for other reflected enums (
contentEditable, etc.). This isattribute reflection only — it does not implement the find-in-page reveal /
beforematchbehavior, which is not meaningful in a headless DOM.
Tests
Added 7 tests: getter returns
falsewhen absent,'until-found'for the keyword,case-insensitively,
trueotherwise; setter sets theuntil-foundstate, removes the attributefor falsy values including
'', and sets plain hidden for other strings. Fullnpm testpasses.AI
I used Claude Code to write this, over multiple iterations. I guided and reviewed
it myself at every step.
Before submitting the PR, please make sure you do the following:
Tests
el.hiddenis"until-found"(typeof string) forhidden="until-found";el.hidden = 'until-found'keeps the attribute"until-found";= truewrites"";= falseremoves it. Matches the fixed behavior.npm testlocally to make sure that all tests pass before submitting the PR.Title
feat,fix,choreorBREAKING CHANGE. The issue is optional and can be omitted if the pull request does not relate to an issue.AI tools