Skip to content

page-fidelity.js class dimension counts only literal Class: strings in the page body: snippet contents, ButtonStyle classes and layout chrome read as missing #157

Closed

Description

@MendixMau

What happens

project-bin/page-fidelity.js score() (~l.404) builds the page's class set from the page's own MDL only: Class: '…' and DynamicClasses tokens. It drops a small fixed chromeSet (topbar, userchip, avatar, content, or the dialog frame on popups).

Three sources of classes that really render are invisible to it, so the wireframe's classes read as missing:

  1. Snippet calls are not expanded. A page that embeds a snippet contributes none of the snippet's classes. grep -i snippet project-bin/page-fidelity.js → nothing.
  2. ButtonStyle: is not mapped to its classes. ButtonStyle: Default renders btn btn-default, and Primary renders btn btn-primary, etc. A wireframe a.btn reads as a missing class on every page that uses styled buttons.
  3. Layout-owned chrome beyond the fixed four. The rail/sidebar/topbar classes a project's own layout renders are not the page's to declare, but only the hard-coded set is excluded. Sample width classes a wireframe uses to mock data (e.g. bar-w-*) are counted too.

Evidence (card-disbursement requirements-driven build, 2026-09-25/26)

  • A dashboard page scored 69% (classes 58/82, actions 1/2).
    • 3 of the 24 "missing" classes were present inside the health snippet the page embeds.
    • Most of the rest were the layout's rail/topbar chrome and the wireframe's sample bar-w-* widths, which the page sets at runtime.
    • Checked against the wireframe class list vs the page and snippet MDL classes (comm).
  • The style-gallery page scored 80%, with a.btn missing on every default button.
  • In both cases the LOOK, not the score, was the check.

Suggested fix

  • Resolve snippetcall <Module>.<Snippet> in the page body, fetch the snippet's MDL the same way the page's is fetched, and union its classes. Do this recursively, with a cycle guard.
  • Map ButtonStyle: <X> to btn + btn-<lowercase X>. Map other widget properties with a fixed rendered class the same way, only where verified in a rendered DOM.
  • Let the chrome set come from the page's layout: the classes in the layout's own MDL, or a chromeClasses list in the project config. Keep reporting them as "chrome (layout-supplied, not scored)", as today.
  • Keep printing the miss list. The percentage stays advisory.

These need golden captures, for example describe snippet output and a rendered DOM for ButtonStyle mapping. That is why this is filed rather than fixed.

Files

  • project-bin/page-fidelity.js: score(), pageMdl()
  • skills/ui-preflight-pages.md / LOOK guidance, if the score's scope changes

Related: the text-match looseness of the same scorer is filed separately.

Activity

  1. added a commit that references this issue on Oct 13, 2026
  2. MendixMau commented on Oct 19, 2026

    @MendixMau
    OwnerAuthor

    Status after 1.0 (v2026.10.19): snippet expansion, ButtonStyle classes and layout chrome are now handled in page-fidelity.js. Still to check: the wireframe sample bar-w-* width classes on a real page. If that scores right, this can close.

  3. MendixMau commented on Oct 20, 2026

    @MendixMau
    OwnerAuthor

    Fixed. Same synthetic wireframe and MDL, run on two versions. Inputs: a snippet with card/kpi, ButtonStyle: Primary, a layout carrying rail, and one bar-w-40.

    • Parent of 31e90ae: classes 3/7, missed: rail bar-w-40 btn btn-primary, 75%.
    • Master: classes 5/6, with rail reported as layout chrome (not scored), 93%.

    Snippet bodies are expanded (95bb212, #191). ButtonStyle maps to btn btn-<style>, and layout chrome is read from describe layout or --chrome (31e90ae, #329). On the open bar-w-* point: when the bar rows repeat, as sample bars do, master classes them as a bound-data mock and does not score them. Only a single-use width class is still counted, and --chrome excludes it. Part of release v2026.10.19. Reopen if a field page misscores.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions