Show a Subject's Schema as one badge wherever it is named - #1345
Open
alistair3149 wants to merge 3 commits into
Open
Show a Subject's Schema as one badge wherever it is named#1345alistair3149 wants to merge 3 commits into
alistair3149 wants to merge 3 commits into
Conversation
Member
Author
alistair3149
force-pushed
the
1328-schema-badge
branch
from
September 3, 2026 00:40
b1aee28 to
83f9f99
Compare
alistair3149
marked this pull request as ready for review
September 3, 2026 00:40
`DataExportButton` carried its own copy of the nine declarations that take an element out of the visual layout while leaving it in the accessibility tree. A second caller is arriving, so they move to `assets/mixins.less` beside `keyboard-focus.less`, imported by reference so nothing is emitted until a rule calls it. Neither Codex nor this build offers one to reuse: Codex's public mixins are `css-icon`, `link` and `button-layout-flush`, and MediaWiki core's `.mixin-screen-reader-text()` is out of reach because the Vite build sets no LESS include path to core. The mixin body is the block it replaces, unchanged, so the emitted CSS for `.ext-neowiki-data-export__sr-only` is byte-identical. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7zBSDFPUVStRFFTzjMLL8
A `secondary` slot renders in place of a node's plain `secondaryLabel` text, inside the same element, so a consumer can give that label a treatment of its own without the tree learning what it means. It forwards through `NeoTreeNode` recursively, like `trailing` already does, and keeps the plain text as its default content. The slot decorates a label rather than replacing the decision to show one: a node with no `secondaryLabel` renders no secondary element, and therefore no slot. That is a real limit of the shape rather than an oversight, so a test pins it. Separately, `__node-secondary` may now shrink. Under `flex: none` a long secondary label took its full max-content width and squeezed the node's own name toward nothing, then pushed the navigator into horizontal scroll; it now gives way to the name and truncates itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7zBSDFPUVStRFFTzjMLL8
For #1328 A Subject's Schema was drawn four ways: a permission-gated link in the editor header that opened the Schema editor rather than navigating, subtle text beside a navigator row, a subtitle link in the infobox, and another beside a statement count in the Subjects manager. Nothing about any of them said "this string is a Schema" — the register they shared is also the register of statement counts, subject ids and the tree's group captions. `SchemaNameDisplay` renders the bare name as a badge and owns the rules the surfaces used to each decide for themselves: where the link goes, and when the name is withheld because it would only repeat the name beside it. Deliberately not a `CdxInfoChip`. A chip is a bordered pill at the size of a navigator row's own text, and thirteen down the demo wiki's tree read as a wall; the badge is a step smaller and squared off. The two stay distinct shapes for distinct ideas — the chip means Property Type on the Schema page, and is left alone. Where it links it takes Codex's normal-weight progressive-action button. Those colours are polyfilled onto the badge itself: the Codex MediaWiki serves ships most of them at older values and the two subtle hover and active fills not at all, and it defines the custom properties it does ship, so a `var()` fallback would never reach ours. `light-dark()` supplies both arms, since MediaWiki's dark mode sets `color-scheme` on the root, and `@supports` guards the block so a browser without it keeps MediaWiki's own values rather than one that is invalid at substitution. Remove that block once MediaWiki 1.47 carries the values. `:visited`, `:hover` and `:focus` are spelled out throughout, which is load-bearing: core styles `a:visited` and underlines `a:hover, a:focus`, each at specificity (0,1,1) — a pseudo-class counts as a class — so they tie with a bare `a.<class>` and win on load order. The withholding rule lives in `schemaNameToShow`, shared by the badge and by the tree's own `secondaryLabel`, so a Subject displayed under its Schema name (ADR 31) shows it once; the infobox and the Subjects manager printed it twice before. The infobox gates its `role="heading"` wrapper on the same rule, or a withheld badge would leave an unnamed heading in the accessibility tree. Two layout fixes the badge's own `max-width` could not make: `min-width: 0` on the infobox header's text column, because a flex item's automatic minimum size is its content's max-content width and a 50-character Schema name pushed the badge through the infobox border; and the tree reaching the badge through NeoTree's slot rather than a stylesheet, so one component owns it and the row's DOM is unchanged — `SubjectTree.spec` asserts a row's children and text exactly, to catch a re-introduced glyph, and still does. Also here: `neowiki-infobox-type` is deleted, being declared and defined but referenced by no code, in the repo or in wiki content. Not here: the editor's own header, which keeps `Schema: X` until the follow-up removes that subtitle wholesale. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7zBSDFPUVStRFFTzjMLL8
alistair3149
force-pushed
the
1328-schema-badge
branch
from
September 3, 2026 01:11
83f9f99 to
6f914cf
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.


For #1328
A Subject's Schema was drawn four ways: a permission-gated link in the editor header that opened the
Schema editor rather than navigating, subtle text beside a navigator row, a subtitle link in the
infobox, and another beside a statement count in the Subjects manager. Nothing about any of them said
"this string is a Schema" — the register they share is also the register of statement counts, subject
ids and the tree's group captions.
SchemaNameDisplayrenders the bare name as a badge and owns the rules each surface used to decidefor itself: where the link goes, whether it opens a tab of its own, and when the name is withheld
because it would only repeat the name beside it.
Decisions worth challenging
A badge, deliberately not a
CdxInfoChip. A chip is a bordered pill at@font-size-small, whichis the size of a navigator row's own text; thirteen of them down the demo wiki's tree read as a wall.
The badge is a step smaller, filled rather than outlined, and on
@background-color-neutralratherthan
-subtle, which would all but vanish on a hovered row and clash on a selected one. Chip andbadge stay distinct shapes for distinct ideas — the chip means Property Type on the Schema page, and
this PR leaves it alone.
The tree gets a slot rather than a stylesheet.
NeoTreegains asecondaryslot, renderedinside the element that held the plain text, so the tree learns nothing about Schemas and one
component still owns the badge. The row's DOM is unchanged, which matters:
SubjectTree.spec.ts:809asserts a row's children and text exactly, to catch a re-introduced glyph,and it still does.
Always a link, and the withholding rule moves in. Reading a Schema is not an edit right, so the
badge no longer hides behind
neowiki-schema-edit.schemaNameToShowis shared by the badge and bythe tree's own
secondaryLabel, so a Subject displayed under its Schema name (ADR 31) shows it once— the infobox and the Subjects manager printed it twice before.
Not here: the editor's own header. It keeps
Schema: Companyfor now. The follow-up removes thatsubtitle wholesale, and changing its click target here would quietly retire the only in-dialog route
to the Schema editor — a call that belongs with the PR redesigning that header. So this PR leaves the
editor header inconsistent with the tree below it, on purpose and briefly.
Also here:
neowiki-infobox-typeis deleted, being declared and defined but referenced by no code;DataExportButton's copy of the visually-hidden rules moves to a shared mixin.Testing
1689 tests pass, up from 1673 — sixteen new. The new ones were mutation-verified: inverting the withholding rule,
making
new-tabstop opening one, linking the tree's badge, removing the badge from the tree, anddropping
displayNameat the infobox and both manager call sites each turn a test red by name. Thelast three of those found real gaps — the first cut of this PR had no test that would have noticed a
call site forgetting to pass the name it displays.
Manual Browser Check
On a wiki with the demo data, logged in:
ACME Inc. Under the infobox title,Companyis a small filled badge, not blue link text.It links to
Schema:Companyin the same tab. Hovering underlines it.The badge is absent rather than repeating the title. (
Special:Subjectson such a page shows thesame: the row named after its Schema carries no badge, one named after its page does.)
does not push them taller. The badge is not a link here — the row is the click target.
Schema: Companyas a link that opens the Schema editor. That isdeliberate for this PR; the follow-up removes it.