Repository navigation
Phase 31 slice G: element states - #251
Merged
Merged
Conversation
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.
Slice G of Phase 31 (docs/specs/PHASE-31-SPEC.md, FR-G1): element states. A
stateproperty draws hover, focus, pressed and disabled from the design system's state tokens, so a states sheet or a screenshot can show them. The spec's "Slice G — contracts pinned before build" block (S9, P1 to P9) records the contracts. The "Slice G — as built" block (S10, Q1 to Q8) records the decisions made while building and every fix from verification.What changes
state: "rest" | "hover" | "focus" | "pressed" | "disabled"onbutton,link,text-input,nav-item,tree-row,menu-row,list-rowand the four controls. Primitives that draw several targets take it on the item: eachtabsandtab-baritem, anav-bar's actions, eachmodalaction and atoastaction. Every other node type ignores it.$focus-ringoutline at a 2px gap (spec change S9). The ring therefore touches only the backdrop and never a brand fill. A tab and a tab-bar item draw it inside their box, because the tablist and a floating bar clip. The live viewer's keyboard focus now uses the same ring colour.$text-primarywhen the state tokens set a disabled opacity (spec change S10):disabledContent(38%)disabledContainer(12%)$bg-surfacestate: "disabled"counts as disabled everywheredisabled: truedoes. It takes the target out of the tab order, out of the 24px census and out of the primary count. The phone's 44px census still measures disabled targets, as it always has.stateand no disabled node renders the same as before, except the live-focus ring colour, which never reaches a capture.batch_designproperty list and every primitive line, a new "Element states" paragraph, theset_variablesstate description, a new "Element states" section indocs/GUIDELINES.mdwith an example, the README primitive tables and a new paragraph, VISION.md, and a discoverability check.Decisions worth a look
tabindex="-1",aria-disabled), as the slice B primitives already did. This changes HTML only, not pixels (Q2).tabsnode now dims its tabs (Q4). Before this slice its opacity was set but never drawn, so it rendered as enabled.disabledas disabled, as it did before. The census and primary count still readdisabled === true, as before.disabledis typed boolean, so the two only disagree on out-of-contract values.disabled: true. It is a follow-up in VISION.md.Testing
test-element-states.ts(fast, 277 checks) covers:state, an unknown value,disabled: truebeatingstate: "hover"test-element-states-render.ts(Chrome) renders four button variants at five states in both themes. Each state renders the same pixels twice, and every pair of states differs.disabledstopped dimmingnoneor with a zero alpha got paintedstatelowered the token-adoption scorergb(255, 165, 0)as an alpha. It also found three wording over-claims. That fix was proved red on 6896c88 and green on ddada5e; no agent re-verified it.npm run test:full: 134/134 on ddada5e and on the final commit, which only tidies two comments.