From f0146a33145f0b5dcce0c7c05ebf15da316c5335 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 08:51:06 -0400 Subject: [PATCH 01/10] fix(bulma-ui): let Level.Item's anchor take the rest of an anchor's attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `LevelItemProps` enumerated `href`, `target` and `rel`, so every other anchor attribute was a type error even at `as="a"` — `` and `referrerPolicy` both failed to compile, which is what #641 reported. The four that matter join the list and are forwarded on the anchor branch beside the three that were already there. Enumerated rather than derived from `as`, deliberately. Deriving them is what makes `` a type error instead of a compiling dead attribute, and it also stops `const p: LevelItemProps = { href }` compiling for consumers who write that today. Both are source-breaking, so #672 carries them under `next-major`. Until then the runtime holds the line the type does not: the new attributes are withheld from any tag that is not an ``, which the tests assert in both directions. Refs #641, #672 --- bestax-mcp/data/catalog.json | 2 +- bestax-mcp/data/components/Level.json | 36 +++++++++++++++ bulma-ui/src/layout/Level.stories.tsx | 33 ++++++++++++++ bulma-ui/src/layout/Level.tsx | 27 +++++++++++ bulma-ui/src/layout/__tests__/Level.test.tsx | 48 ++++++++++++++++++++ docs/docs/api/layout/level.md | 30 ++++++------ 6 files changed, 162 insertions(+), 14 deletions(-) diff --git a/bestax-mcp/data/catalog.json b/bestax-mcp/data/catalog.json index d0f79f20c..e51a538e8 100644 --- a/bestax-mcp/data/catalog.json +++ b/bestax-mcp/data/catalog.json @@ -557,7 +557,7 @@ "slug": "layout/level", "import": "import { Level } from '@allxsmith/bestax-bulma';", "compound": true, - "propCount": 26, + "propCount": 30, "exampleCount": 5 }, { diff --git a/bestax-mcp/data/components/Level.json b/bestax-mcp/data/components/Level.json index f4c27b4ac..53cea8b91 100644 --- a/bestax-mcp/data/components/Level.json +++ b/bestax-mcp/data/components/Level.json @@ -314,6 +314,42 @@ "required": false, "inherited": false, "deprecated": false + }, + { + "name": "download", + "type": "string | boolean", + "default": null, + "description": "`download` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", + "required": false, + "inherited": false, + "deprecated": false + }, + { + "name": "hrefLang", + "type": "string", + "default": null, + "description": "`hrefLang` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", + "required": false, + "inherited": false, + "deprecated": false + }, + { + "name": "ping", + "type": "string", + "default": null, + "description": "`ping` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", + "required": false, + "inherited": false, + "deprecated": false + }, + { + "name": "referrerPolicy", + "type": "React.HTMLAttributeReferrerPolicy", + "default": null, + "description": "`referrerPolicy` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", + "required": false, + "inherited": false, + "deprecated": false } ], "extraProps": [], diff --git a/bulma-ui/src/layout/Level.stories.tsx b/bulma-ui/src/layout/Level.stories.tsx index 7bfd43c5a..bf357278b 100644 --- a/bulma-ui/src/layout/Level.stories.tsx +++ b/bulma-ui/src/layout/Level.stories.tsx @@ -168,3 +168,36 @@ export const CompoundUsage: StoryObj = { ), }; + +/** + * `Level.Item` renders an `` when told to, and that form takes the anchor's + * wider attributes — `download`, `hrefLang`, `ping`, `referrerPolicy` — not + * just `href`/`target`/`rel`. On any other `as` they are withheld rather than + * rendered as dead markup. + */ +export const AnchorItem: StoryObj = { + render: () => ( + + + + Download the report + + + + + Open example.com + + + + ), +}; diff --git a/bulma-ui/src/layout/Level.tsx b/bulma-ui/src/layout/Level.tsx index 466a606c8..b07eed26c 100644 --- a/bulma-ui/src/layout/Level.tsx +++ b/bulma-ui/src/layout/Level.tsx @@ -164,6 +164,17 @@ export const LevelRight: React.FC = ({ /** * Props for the LevelItem component. + * + * The anchor attributes are enumerated here, at every `as`, and forwarded only + * when the tag is an `` — so `` compiles and + * renders a `

` without it. That asymmetry is deliberate for now: deriving + * them from `as` instead is what makes the dead pair a type error, and it also + * stops `const p: LevelItemProps = { href }` compiling for consumers who write + * it today. #672 carries that half, labelled `next-major`. + * + * What this list must NOT become is a shorter one. Enumerating only `href`, + * `target` and `rel` made every other anchor attribute a type error even at + * `as="a"`, which is what #641 reported. */ export interface LevelItemProps extends @@ -191,6 +202,14 @@ export interface LevelItemProps target?: string; /** Rel for "a" tag */ rel?: string; + /** `download` for the `as="a"` form. Forwarded only when the tag is an ``. */ + download?: string | boolean; + /** `hrefLang` for the `as="a"` form. Forwarded only when the tag is an ``. */ + hrefLang?: string; + /** `ping` for the `as="a"` form. Forwarded only when the tag is an ``. */ + ping?: string; + /** `referrerPolicy` for the `as="a"` form. Forwarded only when the tag is an ``. */ + referrerPolicy?: React.HTMLAttributeReferrerPolicy; } /** @@ -208,6 +227,10 @@ export const LevelItem: React.FC = ({ href, target, rel, + download, + hrefLang, + ping, + referrerPolicy, color, bgColor, textColor, @@ -233,6 +256,10 @@ export const LevelItem: React.FC = ({ href={href} target={target} rel={rel} + download={download} + hrefLang={hrefLang} + ping={ping} + referrerPolicy={referrerPolicy} {...rest} > {children} diff --git a/bulma-ui/src/layout/__tests__/Level.test.tsx b/bulma-ui/src/layout/__tests__/Level.test.tsx index 6d04bc496..bc3467b1a 100644 --- a/bulma-ui/src/layout/__tests__/Level.test.tsx +++ b/bulma-ui/src/layout/__tests__/Level.test.tsx @@ -102,6 +102,54 @@ describe('Level', () => { expect(screen.getByTestId('level-item')).toHaveClass('m-2'); }); + it('forwards the wider anchor attributes to the ', () => { + // The ones #641 reported as rejected. They travel as named props, like + // href/target/rel, rather than through the `...rest` spread — so a change + // to the destructure list drops them and only this notices. + render( + + + Download + + + ); + const anchor = screen.getByTestId('wide'); + expect(anchor).toHaveAttribute('download', 'r.pdf'); + expect(anchor).toHaveAttribute('hreflang', 'en'); + expect(anchor).toHaveAttribute('ping', '/p'); + expect(anchor).toHaveAttribute('referrerpolicy', 'no-referrer'); + }); + + it('withholds them from a non-anchor tag', () => { + // They are declared at every `as` — the half #672 leaves to a major — so + // the type permits this and the runtime must not render a dead attribute. + render( + + + Text + + + ); + const p = screen.getByTestId('p'); + expect(p.tagName).toBe('P'); + for (const attr of ['download', 'hreflang', 'ping', 'referrerpolicy']) { + expect(p).not.toHaveAttribute(attr); + } + }); + it('renders as when requested with href and anchor props', () => { render( diff --git a/docs/docs/api/layout/level.md b/docs/docs/api/layout/level.md index 19e683ffb..915387059 100644 --- a/docs/docs/api/layout/level.md +++ b/docs/docs/api/layout/level.md @@ -283,19 +283,23 @@ You can use all [Bulma helper props](../helpers/usebulmaclasses.md) with `` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ----------------- | ----------------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------- | +| `as` | `'div'` \| `'p'` \| `'a'` | `'div'` | Element type to render. | +| `hasTextCentered` | `boolean` | `false` | Center the text in the item. | +| `color` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Bulma color modifier. | +| `bgColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Background color. | +| `textColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Text color. | +| `className` | `string` | — | Additional CSS classes. | +| `children` | `React.ReactNode` | — | Content. | +| `href` | `string` | — | Href for "a" tag. | +| `target` | `string` | — | Target for "a" tag | +| `rel` | `string` | — | Rel for "a" tag | +| `download` | `string` \| `boolean` | — | `download` for the `as="a"` form. Forwarded only when the tag is an ``. | +| `hrefLang` | `string` | — | `hrefLang` for the `as="a"` form. Forwarded only when the tag is an ``. | +| `ping` | `string` | — | `ping` for the `as="a"` form. Forwarded only when the tag is an ``. | +| `referrerPolicy` | `React.HTMLAttributeReferrerPolicy` | — | `referrerPolicy` for the `as="a"` form. Forwarded only when the tag is an ``. | +| `...` | All standard `

` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | From 719596765a03231d828b40ef9925b4ed43b30416 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 08:51:07 -0400 Subject: [PATCH 02/10] fix(bestax-migrate): teach the Level.Item row the attributes it gained MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `TARGET_LINK_ATTRS` records what a target declares when its props do not follow `as`, and `Level.Item` declares four more of them since #672. Left at `['target']` the pass would strip a `download` the component now accepts and write a TODO saying it was rejected. `media` stays off the row because the component still does not declare it, so it remains the one attribute this table catches — which keeps the mechanism, and its e2e assertion, exercised by a real case rather than kept for a hypothetical. Refs #672 --- bestax-migrate/src/sources/_shared/polymorphic.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bestax-migrate/src/sources/_shared/polymorphic.ts b/bestax-migrate/src/sources/_shared/polymorphic.ts index 676f7ada2..1a568fd4a 100644 --- a/bestax-migrate/src/sources/_shared/polymorphic.ts +++ b/bestax-migrate/src/sources/_shared/polymorphic.ts @@ -336,9 +336,9 @@ const LINK_ATTR_ELEMENTS: Record = { * Most components here either follow `as` (the element decides, above) or * extend `AnchorHTMLAttributes` outright (`Pagination.*`, `Panel.Block`, so * everything is fine). `Level.Item` is the exception that enumerates: it - * declares `href`, `target` and `rel` and nothing else, so `download`, - * `hrefLang`, `ping` and `referrerPolicy` are type errors there even at - * `as="a"`. + * enumerates: since #672 it declares `href`, `target`, `rel`, `download`, + * `hrefLang`, `ping` and `referrerPolicy`, and still not `media` — so `media` + * is a type error on its `` where the element would take one. * * A target absent from `HREF_OK` needs no row: a component that takes no * `href` at any `as` takes none of its siblings either -- verified for @@ -346,7 +346,12 @@ const LINK_ATTR_ELEMENTS: Record = { * from that table rather than being a second list to keep. */ const TARGET_LINK_ATTRS: Record = { - 'Level.Item': ['target'], + // `Level.Item` enumerates its anchor props rather than deriving them from + // `as`, so the row lists what it actually declares. It gained four in #672 + // — `download`, `hrefLang`, `ping`, `referrerPolicy` — which were type errors + // on its own `` before. `media` is still absent from the component, so it + // is still the one this table strips. + 'Level.Item': ['target', 'download', 'hrefLang', 'ping', 'referrerPolicy'], }; /** The rows the type test holds to the library. */ From cb7c2ab87e106d2438452a62fecbe4489e0fe0f7 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 08:52:14 -0400 Subject: [PATCH 03/10] docs(skills): correct the Level.Item link-attribute claim in all three copies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same sentence appears verbatim in the bloomer, rbx and react-bulma-components references, and #672 falsifies it on both sides at once: the component now declares four more anchor attributes, and the codemod's row stops stripping them. A migrating agent reading any of the three would keep emitting the superseded advice. Nothing catches this — the copies agree with each other, so `skills-sync` and the generators are green either way. Root CLAUDE.md is the rule that does: skill-affecting changes update `skills/` in the same PR. Refs #672 --- bestax-mcp/data/skills.json | 6 +++--- skills/bestax-migrate/references/bloomer/unmappables.md | 5 +++-- skills/bestax-migrate/references/rbx/unmappables.md | 5 +++-- .../references/react-bulma-components/unmappables.md | 5 +++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bestax-mcp/data/skills.json b/bestax-mcp/data/skills.json index 206fb6708..d39e039f7 100644 --- a/bestax-mcp/data/skills.json +++ b/bestax-mcp/data/skills.json @@ -98,7 +98,7 @@ { "id": "bloomer-unmappables", "file": "references/bloomer/unmappables.md", - "bytes": 16259 + "bytes": 16366 }, { "id": "css-migration", @@ -118,7 +118,7 @@ { "id": "rbx-unmappables", "file": "references/rbx/unmappables.md", - "bytes": 13444 + "bytes": 13551 }, { "id": "react-bulma-components-component-map", @@ -133,7 +133,7 @@ { "id": "react-bulma-components-unmappables", "file": "references/react-bulma-components/unmappables.md", - "bytes": 9448 + "bytes": 9555 } ], "examples": [] diff --git a/skills/bestax-migrate/references/bloomer/unmappables.md b/skills/bestax-migrate/references/bloomer/unmappables.md index b6a8ad175..4b9eac6ec 100644 --- a/skills/bestax-migrate/references/bloomer/unmappables.md +++ b/skills/bestax-migrate/references/bloomer/unmappables.md @@ -156,8 +156,9 @@ on an `` inside, or make the element one that takes it. `rel` is never touched: React declares it on `HTMLAttributes`, so it is valid on every element. A component can be narrower than its element. One that takes no `href` at any `as` takes none of -these either, and `Level.Item` declares only `href`, `target` and `rel` — so `download` and the -rest go there even at `as="a"`. +these either, and `Level.Item` enumerates its anchor props rather than deriving them from `as`: +it declares `href`, `target`, `rel`, `download`, `hrefLang`, `ping` and `referrerPolicy`, so only +`media` goes to the TODO even at `as="a"`. ## `prop:render` — the render prop diff --git a/skills/bestax-migrate/references/rbx/unmappables.md b/skills/bestax-migrate/references/rbx/unmappables.md index 18ce8fbc3..6bce63878 100644 --- a/skills/bestax-migrate/references/rbx/unmappables.md +++ b/skills/bestax-migrate/references/rbx/unmappables.md @@ -91,8 +91,9 @@ on an `` inside, or make the element one that takes it. `rel` is never touched: React declares it on `HTMLAttributes`, so it is valid on every element. A component can be narrower than its element. One that takes no `href` at any `as` takes none of -these either, and `Level.Item` declares only `href`, `target` and `rel` — so `download` and the -rest go there even at `as="a"`. +these either, and `Level.Item` enumerates its anchor props rather than deriving them from `as`: +it declares `href`, `target`, `rel`, `download`, `hrefLang`, `ping` and `referrerPolicy`, so only +`media` goes to the TODO even at `as="a"`. ## `component:Generic` — rbx's base element diff --git a/skills/bestax-migrate/references/react-bulma-components/unmappables.md b/skills/bestax-migrate/references/react-bulma-components/unmappables.md index 809508049..c2ddad6d1 100644 --- a/skills/bestax-migrate/references/react-bulma-components/unmappables.md +++ b/skills/bestax-migrate/references/react-bulma-components/unmappables.md @@ -189,8 +189,9 @@ on an `` inside, or make the element one that takes it. `rel` is never touched: React declares it on `HTMLAttributes`, so it is valid on every element. A component can be narrower than its element. One that takes no `href` at any `as` takes none of -these either, and `Level.Item` declares only `href`, `target` and `rel` — so `download` and the -rest go there even at `as="a"`. +these either, and `Level.Item` enumerates its anchor props rather than deriving them from `as`: +it declares `href`, `target`, `rel`, `download`, `hrefLang`, `ping` and `referrerPolicy`, so only +`media` goes to the TODO even at `as="a"`. ## Helper props dropped from plain-element replacements From e901f91e30e41c3229d3f8436c4c3f3b0af2ecf1 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 18:15:53 -0400 Subject: [PATCH 04/10] fix(bulma-ui): derive Level.Item's anchor attributes instead of listing them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous commit replaced a three-name list with a seven-name list, which leaves `media` and `type` rejected at `as="a"` and leaves the next attribute React adds rejected too. A list gains an entry when someone notices; that is how the component came to refuse `download` in the first place, and #641 is the report. `AnchorOnlyAttributes` subtracts `React.HTMLAttributes` from `React.AnchorHTMLAttributes`, so the set is exactly what an `` adds and it tracks React rather than this file. The runtime strips the same names from any non-anchor tag — one list there, because JS has no view of a type; #682 is the issue for sharing it with the two components carrying their own copies. The non-anchor test now supplies every attribute it asserts against. It checked four and passed two, so two assertions were vacuous and would have held for a prop that leaked. Re-verified non-breaking by compiling the same eleven probes against `main` and this branch: event handlers, the spread round-trip, assignability to `HTMLAttributes`, `ComponentProps`/`keyof`/index access, `React.memo`, the released `Dropdown.Item`, and ordinary usage. Zero errors on both. Refs #641, #672 --- bestax-mcp/data/catalog.json | 2 +- bestax-mcp/data/components/Level.json | 65 +-------------- bestax-migrate/e2e/as-unions.test.ts | 24 ------ .../src/sources/_shared/polymorphic.ts | 19 +++-- bulma-ui/src/layout/Level.tsx | 79 +++++++++++-------- bulma-ui/src/layout/__tests__/Level.test.tsx | 25 +++++- docs/docs/api/layout/level.md | 27 +++---- 7 files changed, 94 insertions(+), 147 deletions(-) diff --git a/bestax-mcp/data/catalog.json b/bestax-mcp/data/catalog.json index e51a538e8..3b0a4b85d 100644 --- a/bestax-mcp/data/catalog.json +++ b/bestax-mcp/data/catalog.json @@ -557,7 +557,7 @@ "slug": "layout/level", "import": "import { Level } from '@allxsmith/bestax-bulma';", "compound": true, - "propCount": 30, + "propCount": 23, "exampleCount": 5 }, { diff --git a/bestax-mcp/data/components/Level.json b/bestax-mcp/data/components/Level.json index 53cea8b91..bbbd3eb9e 100644 --- a/bestax-mcp/data/components/Level.json +++ b/bestax-mcp/data/components/Level.json @@ -287,73 +287,10 @@ "required": false, "inherited": false, "deprecated": false - }, - { - "name": "href", - "type": "string", - "default": null, - "description": "Href for \"a\" tag.", - "required": false, - "inherited": false, - "deprecated": false - }, - { - "name": "target", - "type": "string", - "default": null, - "description": "Target for \"a\" tag", - "required": false, - "inherited": false, - "deprecated": false - }, - { - "name": "rel", - "type": "string", - "default": null, - "description": "Rel for \"a\" tag", - "required": false, - "inherited": false, - "deprecated": false - }, - { - "name": "download", - "type": "string | boolean", - "default": null, - "description": "`download` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", - "required": false, - "inherited": false, - "deprecated": false - }, - { - "name": "hrefLang", - "type": "string", - "default": null, - "description": "`hrefLang` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", - "required": false, - "inherited": false, - "deprecated": false - }, - { - "name": "ping", - "type": "string", - "default": null, - "description": "`ping` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", - "required": false, - "inherited": false, - "deprecated": false - }, - { - "name": "referrerPolicy", - "type": "React.HTMLAttributeReferrerPolicy", - "default": null, - "description": "`referrerPolicy` for the `as=\"a\"` form. Forwarded only when the tag is an ``.", - "required": false, - "inherited": false, - "deprecated": false } ], "extraProps": [], - "catchAll": "All standard
attributes and Bulma helper props", + "catchAll": "All standard /
attributes and Bulma helper props", "types": [] } ], diff --git a/bestax-migrate/e2e/as-unions.test.ts b/bestax-migrate/e2e/as-unions.test.ts index 94a296484..7132b9443 100644 --- a/bestax-migrate/e2e/as-unions.test.ts +++ b/bestax-migrate/e2e/as-unions.test.ts @@ -381,30 +381,6 @@ describe('the per-target link-attribute exception matches the library', () => { diagnostics: '', }); }); - - it('holds `Level.Item` to exactly the link attributes it declares', () => { - // Most href-capable targets either follow `as` or extend - // `AnchorHTMLAttributes`; this one enumerates, and the rule has a row for - // it. Asserted by use, both ways. - const rows: string[] = [ - "import { Level } from '@allxsmith/bestax-bulma';", - '', - `export const ok = {'x'};`, - ]; - for (const attr of Object.keys(LINK_ATTR_TABLE)) { - if (TARGET_LINK_ATTR_TABLE['Level.Item'].includes(attr)) continue; - rows.push(`// @ts-expect-error Level.Item declares no ${attr}`); - rows.push( - `export const n_${attr} = {'x'};` - ); - } - const source = rows.join('\n') + '\n'; - const { status, diagnostics } = typecheckTsx(source, 'target-link-attrs'); - expect({ status, diagnostics: annotate(diagnostics, source) }).toEqual({ - status: 0, - diagnostics: '', - }); - }); }); describe('the href-bearing intrinsics match what React types', () => { diff --git a/bestax-migrate/src/sources/_shared/polymorphic.ts b/bestax-migrate/src/sources/_shared/polymorphic.ts index 1a568fd4a..0cc1fd35d 100644 --- a/bestax-migrate/src/sources/_shared/polymorphic.ts +++ b/bestax-migrate/src/sources/_shared/polymorphic.ts @@ -346,12 +346,19 @@ const LINK_ATTR_ELEMENTS: Record = { * from that table rather than being a second list to keep. */ const TARGET_LINK_ATTRS: Record = { - // `Level.Item` enumerates its anchor props rather than deriving them from - // `as`, so the row lists what it actually declares. It gained four in #672 - // — `download`, `hrefLang`, `ping`, `referrerPolicy` — which were type errors - // on its own `` before. `media` is still absent from the component, so it - // is still the one this table strips. - 'Level.Item': ['target', 'download', 'hrefLang', 'ping', 'referrerPolicy'], + // Empty since #672. `Level.Item` was the only row: it listed `href`, `target` + // and `rel` and stopped, so the element alone could not say that `download` + // was rejected. It now enumerates the anchor's attributes by SUBTRACTING + // `React.HTMLAttributes` from `React.AnchorHTMLAttributes`, which is all of + // them — and a row naming all of them decides nothing a row naming none does + // not, so the element decides and the row goes. + // + // The mechanism stays for a target that really is narrower than its element, + // and the e2e asserts the premise rather than assuming it: every href-capable + // target without a row accepts every link attribute on its anchor. + // `Level.Item` joins that sweep, so its coverage moved rather than going. + // NOTE that leaves the `rejectedBy = 'component'` arm with no live caller — + // worth deleting and restoring from git if nothing claims it. }; /** The rows the type test holds to the library. */ diff --git a/bulma-ui/src/layout/Level.tsx b/bulma-ui/src/layout/Level.tsx index b07eed26c..7922cbc29 100644 --- a/bulma-ui/src/layout/Level.tsx +++ b/bulma-ui/src/layout/Level.tsx @@ -162,6 +162,25 @@ export const LevelRight: React.FC = ({ ); }; +/** + * Exactly what `` adds over the attributes every element has: `href`, + * `target`, `rel`, `download`, `hrefLang`, `ping`, `referrerPolicy`, `media`, + * `type`. + * + * Subtracted from React's own types rather than listed. Listing them is how this + * component came to reject `download` at `as="a"` — the list said `href`, + * `target`, `rel` and stopped, and #641 is the report. A list gains an entry only + * when someone notices; a subtraction gains it when React does. + * + * They reach the `` branch and no other: declared at every `as` because + * narrowing them to the anchor is source-breaking (#672, `next-major`), and + * withheld at runtime so the type's permissiveness costs no dead markup. + */ +type AnchorOnlyAttributes = Omit< + React.AnchorHTMLAttributes, + keyof React.HTMLAttributes +>; + /** * Props for the LevelItem component. * @@ -178,6 +197,7 @@ export const LevelRight: React.FC = ({ */ export interface LevelItemProps extends + AnchorOnlyAttributes, React.HTMLAttributes< HTMLDivElement | HTMLParagraphElement | HTMLAnchorElement >, @@ -196,20 +216,6 @@ export interface LevelItemProps className?: string; /** Content. */ children?: React.ReactNode; - /** Href for "a" tag. */ - href?: string; - /** Target for "a" tag */ - target?: string; - /** Rel for "a" tag */ - rel?: string; - /** `download` for the `as="a"` form. Forwarded only when the tag is an ``. */ - download?: string | boolean; - /** `hrefLang` for the `as="a"` form. Forwarded only when the tag is an ``. */ - hrefLang?: string; - /** `ping` for the `as="a"` form. Forwarded only when the tag is an ``. */ - ping?: string; - /** `referrerPolicy` for the `as="a"` form. Forwarded only when the tag is an ``. */ - referrerPolicy?: React.HTMLAttributeReferrerPolicy; } /** @@ -224,13 +230,6 @@ export const LevelItem: React.FC = ({ hasTextCentered, className, children, - href, - target, - rel, - download, - hrefLang, - ping, - referrerPolicy, color, bgColor, textColor, @@ -248,27 +247,39 @@ export const LevelItem: React.FC = ({ }); const levelItemClasses = classNames(mainClass, bulmaHelperClasses, className); - // If rendering as "a", only pass anchor-specific props + // The anchor's own attributes reach an `` and nothing else. The type + // declares them at every `as` — narrowing that is source-breaking (#672) — so + // the runtime is what keeps `` from rendering a + // dead attribute. One list, because JS has no view of the type; #682 is the + // issue for sharing it with the two components that keep their own copies. + const ANCHOR_ONLY = [ + 'href', + 'target', + 'rel', + 'download', + 'hrefLang', + 'ping', + 'referrerPolicy', + 'media', + 'type', + ] as const; + if (Tag === 'a') { return ( - + {children} ); } + const withoutAnchorAttrs = Object.fromEntries( + Object.entries(rest).filter( + ([key]) => !(ANCHOR_ONLY as readonly string[]).includes(key) + ) + ); + return ( - + {children} ); diff --git a/bulma-ui/src/layout/__tests__/Level.test.tsx b/bulma-ui/src/layout/__tests__/Level.test.tsx index bc3467b1a..ea2766f7c 100644 --- a/bulma-ui/src/layout/__tests__/Level.test.tsx +++ b/bulma-ui/src/layout/__tests__/Level.test.tsx @@ -115,6 +115,8 @@ describe('Level', () => { hrefLang="en" ping="/p" referrerPolicy="no-referrer" + media="print" + type="application/pdf" data-testid="wide" > Download @@ -126,6 +128,8 @@ describe('Level', () => { expect(anchor).toHaveAttribute('hreflang', 'en'); expect(anchor).toHaveAttribute('ping', '/p'); expect(anchor).toHaveAttribute('referrerpolicy', 'no-referrer'); + expect(anchor).toHaveAttribute('media', 'print'); + expect(anchor).toHaveAttribute('type', 'application/pdf'); }); it('withholds them from a non-anchor tag', () => { @@ -135,8 +139,15 @@ describe('Level', () => { Text @@ -145,7 +156,19 @@ describe('Level', () => { ); const p = screen.getByTestId('p'); expect(p.tagName).toBe('P'); - for (const attr of ['download', 'hreflang', 'ping', 'referrerpolicy']) { + // Every attribute the type admits has to be supplied here, or the assertion + // for it is vacuous — it would pass on a prop that was never sent. + for (const attr of [ + 'href', + 'target', + 'rel', + 'download', + 'hreflang', + 'ping', + 'referrerpolicy', + 'media', + 'type', + ]) { expect(p).not.toHaveAttribute(attr); } }); diff --git a/docs/docs/api/layout/level.md b/docs/docs/api/layout/level.md index 915387059..b73b609ac 100644 --- a/docs/docs/api/layout/level.md +++ b/docs/docs/api/layout/level.md @@ -283,23 +283,16 @@ You can use all [Bulma helper props](../helpers/usebulmaclasses.md) with ``. | -| `hrefLang` | `string` | — | `hrefLang` for the `as="a"` form. Forwarded only when the tag is an ``. | -| `ping` | `string` | — | `ping` for the `as="a"` form. Forwarded only when the tag is an ``. | -| `referrerPolicy` | `React.HTMLAttributeReferrerPolicy` | — | `referrerPolicy` for the `as="a"` form. Forwarded only when the tag is an ``. | -| `...` | All standard `
` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | +| Prop | Type | Default | Description | +| ----------------- | ----------------------------------------------------------------------- | ------- | ------------------------------------------------- | +| `as` | `'div'` \| `'p'` \| `'a'` | `'div'` | Element type to render. | +| `hasTextCentered` | `boolean` | `false` | Center the text in the item. | +| `color` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Bulma color modifier. | +| `bgColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Background color. | +| `textColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Text color. | +| `className` | `string` | — | Additional CSS classes. | +| `children` | `React.ReactNode` | — | Content. | +| `...` | All standard `` / `
` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | From 3f2552a6e5e6aaf847e08c79fa63164a5ca39892 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 22:38:37 -0400 Subject: [PATCH 05/10] fix(docs): name every element a union-based component renders `catchAllRow` read the props base with `String.match` and no `/g`, so a component whose base is a union of elements was described by whichever came first. `Level.Item` is `HTMLDivElement | HTMLParagraphElement | HTMLAnchorElement` and its page said "All standard `
` attributes", naming neither the `

` nor the `` it also renders; `Title` and `SubTitle` lost their `

` the same way. Both generators call `extractComponent`, so the API pages and the MCP index an assistant answers from were wrong together, and both are regenerated here. Refs #672 --- bestax-mcp/data/components/Level.json | 2 +- bestax-mcp/data/components/SubTitle.json | 2 +- bestax-mcp/data/components/Title.json | 2 +- docs/docs/api/elements/subtitle.md | 2 +- docs/docs/api/elements/title.md | 2 +- docs/docs/api/layout/level.md | 2 +- scripts/lib/props-extract.mjs | 10 ++++++++-- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bestax-mcp/data/components/Level.json b/bestax-mcp/data/components/Level.json index bbbd3eb9e..131954829 100644 --- a/bestax-mcp/data/components/Level.json +++ b/bestax-mcp/data/components/Level.json @@ -290,7 +290,7 @@ } ], "extraProps": [], - "catchAll": "All standard /

attributes and Bulma helper props", + "catchAll": "All standard /
/

attributes and Bulma helper props", "types": [] } ], diff --git a/bestax-mcp/data/components/SubTitle.json b/bestax-mcp/data/components/SubTitle.json index fc87a4d82..f54e82e26 100644 --- a/bestax-mcp/data/components/SubTitle.json +++ b/bestax-mcp/data/components/SubTitle.json @@ -128,7 +128,7 @@ "deprecated": false } ], - "catchAll": "All standard

–

attributes and Bulma helper props", + "catchAll": "All standard

–

/

attributes and Bulma helper props", "types": [] } ], diff --git a/bestax-mcp/data/components/Title.json b/bestax-mcp/data/components/Title.json index 286b6cc30..bcfa719f0 100644 --- a/bestax-mcp/data/components/Title.json +++ b/bestax-mcp/data/components/Title.json @@ -135,7 +135,7 @@ "deprecated": false } ], - "catchAll": "All standard

–

attributes and Bulma helper props", + "catchAll": "All standard

–

/

attributes and Bulma helper props", "types": [] } ], diff --git a/docs/docs/api/elements/subtitle.md b/docs/docs/api/elements/subtitle.md index 59820c5af..90c688e81 100644 --- a/docs/docs/api/elements/subtitle.md +++ b/docs/docs/api/elements/subtitle.md @@ -164,7 +164,7 @@ Combine `Title` and `SubTitle` components for a structured heading and subheadin | `textColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Text color helper. | | `bgColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Background color helper. | | `skeleton` | `boolean` | — | Applies the `is-skeleton` class to the entire component. | -| `...` | All standard `

`–`

` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | +| `...` | All standard `

`–`

` / `

` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | diff --git a/docs/docs/api/elements/title.md b/docs/docs/api/elements/title.md index 06bab1f08..cedea1c49 100644 --- a/docs/docs/api/elements/title.md +++ b/docs/docs/api/elements/title.md @@ -174,7 +174,7 @@ When using `as="p"`, the element is visually styled as a heading but semanticall | `textColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Text color helper. | | `bgColor` | [Bulma color](../helpers/valid-values.md) \| `'inherit'` \| `'current'` | — | Background color helper. | | `skeleton` | `boolean` | — | Applies the `is-skeleton` class to the entire component. | -| `...` | All standard `

`–`

` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | +| `...` | All standard `

`–`

` / `

` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | diff --git a/docs/docs/api/layout/level.md b/docs/docs/api/layout/level.md index b73b609ac..33e24e0d2 100644 --- a/docs/docs/api/layout/level.md +++ b/docs/docs/api/layout/level.md @@ -292,7 +292,7 @@ You can use all [Bulma helper props](../helpers/usebulmaclasses.md) with `` / `

` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | +| `...` | All standard `` / `
` / `

` attributes and Bulma helper props | — | See [Helper Props](../helpers/usebulmaclasses.md) | diff --git a/scripts/lib/props-extract.mjs b/scripts/lib/props-extract.mjs index bcd6b94e5..6e9e21b86 100644 --- a/scripts/lib/props-extract.mjs +++ b/scripts/lib/props-extract.mjs @@ -1188,8 +1188,14 @@ function catchAllRow(external, markdown = true) { ); continue; } - const m = e.text.match(/HTML\w*Element/); - if (m) elements.add(DOM_ELEMENT_LABELS[m[0]] ?? 'HTML'); + // Every match, not the first. A component whose base is a UNION of elements + // — `Level.Item` is `HTMLDivElement | HTMLParagraphElement | HTMLAnchorElement` + // — was described by whichever one came first, so its page and the MCP index + // both said "

attributes" and named neither the `

` nor the `` it + // also renders. + for (const m of e.text.matchAll(/HTML\w*Element/g)) { + elements.add(DOM_ELEMENT_LABELS[m[0]] ?? 'HTML'); + } } // Surfaced so a test can hold every polymorphic component to a RECOGNIZED // constraint. 'unknown' silently takes the open wording, which over-promises From 37968042b43f8ffcaa4dde9fb0368120d097a2c3 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 22:38:38 -0400 Subject: [PATCH 06/10] test(bulma-ui): pin Level.Item's compatibility where it can be checked again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The non-breaking guarantees were verified with throwaway probe files while the polymorphic version of this change was written and reverted — and a probe proves nothing once it is deleted, which is why the PR description could claim assertions that did not exist. Each line is a shape that version actually broke, measured at the time: an event handler written against the alias (an implicit `any` once the base became a non-distributive `Omit`), a props bag spread back into its own component, assignability to `HTMLAttributes`, `keyof` and index access on `ComponentProps` (a union's `keyof` is the intersection of its members'), and a `React.memo` wrapper keeping every tag. The jest comment describing how these attributes travel was also stale: they are not destructured any more, they reach the `` through `...rest` and are filtered out of it for every other tag. Refs #672 --- bulma-ui/src/__typetests__/polymorphic.tsx | 55 ++++++++++++++++++++ bulma-ui/src/layout/__tests__/Level.test.tsx | 7 +-- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/bulma-ui/src/__typetests__/polymorphic.tsx b/bulma-ui/src/__typetests__/polymorphic.tsx index 68fd08d82..7279b2bf0 100644 --- a/bulma-ui/src/__typetests__/polymorphic.tsx +++ b/bulma-ui/src/__typetests__/polymorphic.tsx @@ -20,6 +20,7 @@ */ import React from 'react'; import { Avatar } from '../components/Avatar'; +import { Level, type LevelItemProps } from '../layout/Level'; import { Dropdown, type DropdownItemElement, @@ -341,3 +342,57 @@ export const rejected = ( ); + +// -------------------------------------------------------------------------- +// `Level.Item` (#672). It is NOT polymorphic: it enumerates the anchor's +// attributes by subtracting `HTMLAttributes` from `AnchorHTMLAttributes`, and +// withholds them at runtime for any tag that is not an ``. Deriving them +// from `as` is the source-breaking half, deferred. +// +// These exist because the compatibility was checked with throwaway probes +// while the polymorphic version was written and reverted, and a probe proves +// nothing after it is deleted. Each line below is a shape that version broke. +// -------------------------------------------------------------------------- + +export const levelItemGained = ( + <> + {/* #641's symptom, and the two a hand-written list kept missing. */} + + + + +); + +// An event handler written against the ALIAS keeps its contextual type. The +// polymorphic version turned one handler over a union element into a union of +// three handler types, and this became an implicit `any`. +export const levelItemHandler: LevelItemProps = { + onClick: event => void event.currentTarget, +}; + +// A props bag spreads back into its own component — the canonical wrapper +// shape, and `TS2769` under the reverted version. +declare const levelItemBag: LevelItemProps; +export const levelItemSpread = ; + +// The alias stays assignable to a single element's attributes. +declare function wantsDivAttributes( + props: React.HTMLAttributes +): void; +export const levelItemAssignable = () => wantsDivAttributes(levelItemBag); + +// `ComponentProps` keeps its keys reachable: `keyof` a union is the +// INTERSECTION of its members' keys, so a union-shaped props type loses them. +type LevelItemDerived = React.ComponentProps; +export const levelItemKey: keyof LevelItemDerived = 'href'; +export const levelItemIndexed: LevelItemDerived['href'] = '/x'; +export const levelItemDerivedTag: LevelItemDerived = { as: 'p' }; + +// And a memo wrapper keeps every tag. +const MemoLevelItem = React.memo(Level.Item); +export const levelItemMemo = ( + <> + + + +); diff --git a/bulma-ui/src/layout/__tests__/Level.test.tsx b/bulma-ui/src/layout/__tests__/Level.test.tsx index ea2766f7c..9e9585c4f 100644 --- a/bulma-ui/src/layout/__tests__/Level.test.tsx +++ b/bulma-ui/src/layout/__tests__/Level.test.tsx @@ -103,9 +103,10 @@ describe('Level', () => { }); it('forwards the wider anchor attributes to the ', () => { - // The ones #641 reported as rejected. They travel as named props, like - // href/target/rel, rather than through the `...rest` spread — so a change - // to the destructure list drops them and only this notices. + // The ones #641 reported as rejected. They are not destructured — they reach + // the `` through `...rest`, and are filtered out of it for every other + // tag — so a change to that filter, or to `useBulmaClasses`, drops them and + // only this notices. render( Date: Tue, 15 Sep 2026 22:38:39 -0400 Subject: [PATCH 07/10] docs(bestax-migrate): correct the Level.Item premise in the table and the skills MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two rounds of edits to the same paragraph left it saying "the exception that enumerates: it enumerates", and saying `media` is a type error on Level.Item's anchor — which stopped being true when the component started subtracting `HTMLAttributes` from `AnchorHTMLAttributes` rather than listing names. So no target is narrower than its element now, and the paragraph says that instead, keeping the enumerated case as the shape a future row would answer. The three shipped migration references carried the same stale `media` claim and are corrected with it. Refs #672 --- bestax-mcp/data/skills.json | 6 +++--- bestax-migrate/src/sources/_shared/polymorphic.ts | 15 +++++++++------ .../references/bloomer/unmappables.md | 6 +++--- .../bestax-migrate/references/rbx/unmappables.md | 6 +++--- .../react-bulma-components/unmappables.md | 6 +++--- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/bestax-mcp/data/skills.json b/bestax-mcp/data/skills.json index d39e039f7..721a6c2d7 100644 --- a/bestax-mcp/data/skills.json +++ b/bestax-mcp/data/skills.json @@ -98,7 +98,7 @@ { "id": "bloomer-unmappables", "file": "references/bloomer/unmappables.md", - "bytes": 16366 + "bytes": 16354 }, { "id": "css-migration", @@ -118,7 +118,7 @@ { "id": "rbx-unmappables", "file": "references/rbx/unmappables.md", - "bytes": 13551 + "bytes": 13539 }, { "id": "react-bulma-components-component-map", @@ -133,7 +133,7 @@ { "id": "react-bulma-components-unmappables", "file": "references/react-bulma-components/unmappables.md", - "bytes": 9555 + "bytes": 9543 } ], "examples": [] diff --git a/bestax-migrate/src/sources/_shared/polymorphic.ts b/bestax-migrate/src/sources/_shared/polymorphic.ts index 0cc1fd35d..9b2745ab5 100644 --- a/bestax-migrate/src/sources/_shared/polymorphic.ts +++ b/bestax-migrate/src/sources/_shared/polymorphic.ts @@ -333,12 +333,15 @@ const LINK_ATTR_ELEMENTS: Record = { /** * The link attributes a target accepts, where its props do not follow `as`. * - * Most components here either follow `as` (the element decides, above) or - * extend `AnchorHTMLAttributes` outright (`Pagination.*`, `Panel.Block`, so - * everything is fine). `Level.Item` is the exception that enumerates: it - * enumerates: since #672 it declares `href`, `target`, `rel`, `download`, - * `hrefLang`, `ping` and `referrerPolicy`, and still not `media` — so `media` - * is a type error on its `` where the element would take one. + * Every component here either follows `as` (the element decides, above) or + * carries the anchor's attributes outright — `Pagination.*` and `Panel.Block` + * by extending `AnchorHTMLAttributes`, `Level.Item` since #672 by subtracting + * `HTMLAttributes` from it. So none is narrower than the element it renders, + * and none needs a row. + * + * A target that ENUMERATED a subset would be, and the rule would have to know: + * `Level.Item` listed `href`, `target` and `rel` and stopped, which made + * `download` a type error on its own ``. * * A target absent from `HREF_OK` needs no row: a component that takes no * `href` at any `as` takes none of its siblings either -- verified for diff --git a/skills/bestax-migrate/references/bloomer/unmappables.md b/skills/bestax-migrate/references/bloomer/unmappables.md index 4b9eac6ec..f215dc123 100644 --- a/skills/bestax-migrate/references/bloomer/unmappables.md +++ b/skills/bestax-migrate/references/bloomer/unmappables.md @@ -156,9 +156,9 @@ on an `` inside, or make the element one that takes it. `rel` is never touched: React declares it on `HTMLAttributes`, so it is valid on every element. A component can be narrower than its element. One that takes no `href` at any `as` takes none of -these either, and `Level.Item` enumerates its anchor props rather than deriving them from `as`: -it declares `href`, `target`, `rel`, `download`, `hrefLang`, `ping` and `referrerPolicy`, so only -`media` goes to the TODO even at `as="a"`. +these either. `Level.Item` is not narrower: it declares the anchor's whole attribute surface at +every `as` and forwards it only on the ``, so all of these survive at `as="a"` and none of +them reaches a `

` or a `

`. ## `prop:render` — the render prop diff --git a/skills/bestax-migrate/references/rbx/unmappables.md b/skills/bestax-migrate/references/rbx/unmappables.md index 6bce63878..0b6ff9c60 100644 --- a/skills/bestax-migrate/references/rbx/unmappables.md +++ b/skills/bestax-migrate/references/rbx/unmappables.md @@ -91,9 +91,9 @@ on an `` inside, or make the element one that takes it. `rel` is never touched: React declares it on `HTMLAttributes`, so it is valid on every element. A component can be narrower than its element. One that takes no `href` at any `as` takes none of -these either, and `Level.Item` enumerates its anchor props rather than deriving them from `as`: -it declares `href`, `target`, `rel`, `download`, `hrefLang`, `ping` and `referrerPolicy`, so only -`media` goes to the TODO even at `as="a"`. +these either. `Level.Item` is not narrower: it declares the anchor's whole attribute surface at +every `as` and forwards it only on the ``, so all of these survive at `as="a"` and none of +them reaches a `

` or a `

`. ## `component:Generic` — rbx's base element diff --git a/skills/bestax-migrate/references/react-bulma-components/unmappables.md b/skills/bestax-migrate/references/react-bulma-components/unmappables.md index c2ddad6d1..94c5c146b 100644 --- a/skills/bestax-migrate/references/react-bulma-components/unmappables.md +++ b/skills/bestax-migrate/references/react-bulma-components/unmappables.md @@ -189,9 +189,9 @@ on an `` inside, or make the element one that takes it. `rel` is never touched: React declares it on `HTMLAttributes`, so it is valid on every element. A component can be narrower than its element. One that takes no `href` at any `as` takes none of -these either, and `Level.Item` enumerates its anchor props rather than deriving them from `as`: -it declares `href`, `target`, `rel`, `download`, `hrefLang`, `ping` and `referrerPolicy`, so only -`media` goes to the TODO even at `as="a"`. +these either. `Level.Item` is not narrower: it declares the anchor's whole attribute surface at +every `as` and forwards it only on the ``, so all of these survive at `as="a"` and none of +them reaches a `

` or a `

`. ## Helper props dropped from plain-element replacements From 809d3ccae82c37af066ab49bbbd8d45490c870b1 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 22:41:52 -0400 Subject: [PATCH 08/10] docs(bestax-migrate): cite symbols rather than line numbers Both citations in the `HREF_OK` docblock pointed into files this PR rewrote, and one had already rotted: `bulma-ui/src/layout/Level.tsx:227` now lands on a comment terminator. The claims around them are still true, so the next reader checking the premise behind this table would have found nothing and either re-derived it or deleted a correct note. A symbol survives an edit above it; a line number does not. Refs #672 --- bestax-migrate/src/sources/_shared/polymorphic.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bestax-migrate/src/sources/_shared/polymorphic.ts b/bestax-migrate/src/sources/_shared/polymorphic.ts index 9b2745ab5..c8e3515a8 100644 --- a/bestax-migrate/src/sources/_shared/polymorphic.ts +++ b/bestax-migrate/src/sources/_shared/polymorphic.ts @@ -92,8 +92,7 @@ const AS_ANY = new Set(['Button', 'Menu.Item', 'Navbar.Item', 'Navbar.Link']); * typechecking cannot answer the question on its own. `Level.Item` declares * `href` on its props at every `as`, so `` compiles -- * but it renders a
and forwards `href` only when the tag is an `` - * (`bulma-ui/src/layout/Level.tsx:227`), so the attribute is dropped at - * runtime. A table built from the types alone calls that supported; it is the + * (`LevelItem`'s anchor branch), so the attribute is dropped at runtime. A table built from the types alone calls that supported; it is the * same dead attribute this pass exists to remove. */ const HREF_OK: Record = { @@ -287,7 +286,7 @@ export const AS_ANY_TARGETS: readonly string[] = [...AS_ANY].sort(); * * They are excluded because the components disagree about what they forward, * so no shared set is right. `Menu.Item` strips `href` unless the tag is an - * `` or a custom component (`bulma-ui/src/components/Menu.tsx:212-222`), + * `` or a custom component (`MenuItem`'s `isLinkLike` guard), * while `Button` routes everything but `'button'` through its anchor path and * would forward it. Keeping `href` beside `as="area"` therefore typechecks on * both and does nothing on one of them, which is the silently-dead attribute From ef68d4335172b9d501835cc0214b28e59820e1a5 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 22:51:05 -0400 Subject: [PATCH 09/10] test(docs): pin that a union element base names every element The extractor fix had only the regenerated pages as evidence, and those are not a guard: a one-match implementation regenerates them just as incomplete, and `gen:api-docs:check` calls that fresh. `Level.Item` must name its ``, `
` and `

`, and `Title`/`SubTitle` their `

`. Refs #672 --- scripts/props-extract.test.mjs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/props-extract.test.mjs b/scripts/props-extract.test.mjs index fd1d3bff3..a507db691 100644 --- a/scripts/props-extract.test.mjs +++ b/scripts/props-extract.test.mjs @@ -241,6 +241,28 @@ test('every polymorphic component has a recognized `as` constraint', () => { assert.deepEqual(table('Button', 'Button').catchAll.asKinds, ['open']); }); +test('a union element base names every element, not the first', () => { + // `catchAllRow` read the base with `String.match` and no `/g`, so a component + // whose props extend `HTMLAttributes` was described by whichever + // element came first. The regenerated pages are not the guard: a one-match + // implementation regenerates them just as incomplete, and `gen:*:check` calls + // that fresh. + assert.match( + table('Level', 'Level.Item').catchAll.text, + /`` \/ `

` \/ `

` attributes/ + ); + for (const [component, path] of [ + ['Title', 'Title'], + ['SubTitle', 'SubTitle'], + ]) { + assert.match( + table(component, path).catchAll.text, + /`

`/, + `${path} drops the

it also renders` + ); + } +}); + test('every polymorphic component names a concrete default element', () => { // A type parameter defaulting to the CONSTRAINT rather than to a tag — // `` — makes From b2a1405ae8aa22060a853cc48a52b1d9b3e4ad67 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Tue, 15 Sep 2026 23:11:15 -0400 Subject: [PATCH 10/10] fix(bulma-ui): tie Level.Item's runtime filter to the type it mirrors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The type was derived and the runtime filter was a hand-written array beside it, which drifts in the one direction that matters: the day React adds an anchor attribute, `AnchorOnlyAttributes` accepts it at every `as` while the array lets it leak onto a `

`. That is the failure mode the subtraction was chosen to prevent, reintroduced two lines below it. `Record` makes an upstream addition a compile error here until the filter catches up — verified by removing a key and watching `tsc` name it. `rel` is separate on purpose, and the docblock claimed otherwise: React declares it on `HTMLAttributes`, so the subtraction removes it. This component withholds it from a non-anchor because it always has, which is a compatibility decision rather than a fact about anchors — now stated where each name comes from. Refs #672 --- bulma-ui/src/layout/Level.tsx | 48 ++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/bulma-ui/src/layout/Level.tsx b/bulma-ui/src/layout/Level.tsx index 7922cbc29..df40aa54c 100644 --- a/bulma-ui/src/layout/Level.tsx +++ b/bulma-ui/src/layout/Level.tsx @@ -164,8 +164,12 @@ export const LevelRight: React.FC = ({ /** * Exactly what `` adds over the attributes every element has: `href`, - * `target`, `rel`, `download`, `hrefLang`, `ping`, `referrerPolicy`, `media`, - * `type`. + * `target`, `download`, `hrefLang`, `ping`, `referrerPolicy`, `media`, `type`. + * + * NOT `rel`, which React declares on `HTMLAttributes` for every element and the + * subtraction therefore removes. This component withholds it from a non-anchor + * anyway, because it always has — see `ANCHOR_ONLY` in the implementation, + * where it is named separately for that reason. * * Subtracted from React's own types rather than listed. Listing them is how this * component came to reject `download` at `as="a"` — the list said `href`, @@ -250,19 +254,29 @@ export const LevelItem: React.FC = ({ // The anchor's own attributes reach an `` and nothing else. The type // declares them at every `as` — narrowing that is source-breaking (#672) — so // the runtime is what keeps `` from rendering a - // dead attribute. One list, because JS has no view of the type; #682 is the - // issue for sharing it with the two components that keep their own copies. - const ANCHOR_ONLY = [ - 'href', - 'target', - 'rel', - 'download', - 'hrefLang', - 'ping', - 'referrerPolicy', - 'media', - 'type', - ] as const; + // dead attribute. + // + // Keyed off `AnchorOnlyAttributes` rather than repeated as a list, because a + // hand list beside a derived type drifts in the one direction that matters: + // the day React adds an anchor attribute, the type would accept it at every + // `as` while the list let it leak onto a `
`. `Record` makes that a + // compile error here until this object catches up. #682 is the issue for + // sharing the rule with the two components that keep their own copies. + const ANCHOR_ONLY: Record = { + href: true, + target: true, + download: true, + hrefLang: true, + ping: true, + referrerPolicy: true, + media: true, + type: true, + // `rel` is NOT in the subtraction: React declares it on `HTMLAttributes`, + // for every element. It is here because this component has always withheld + // it from a non-anchor, and it is named separately so the key set above + // stays honest about where each name comes from. + rel: true, + }; if (Tag === 'a') { return ( @@ -273,9 +287,7 @@ export const LevelItem: React.FC = ({ } const withoutAnchorAttrs = Object.fromEntries( - Object.entries(rest).filter( - ([key]) => !(ANCHOR_ONLY as readonly string[]).includes(key) - ) + Object.entries(rest).filter(([key]) => !(key in ANCHOR_ONLY)) ); return (