Repository navigation
[experimental] export: the first paint asks for no focus; the script owns it - #12320
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the render's new focus behavior; the code itself has no blocking finding.
- No current spec record says that
astryx experimental renderdropsautofocusfrom the markup it writes and leaves focus to the page's script, and no decision is recorded on this pull request: an engineering owner records it by commenting/approve-spec <full head SHA>(or an owner-decision comment) on the pull request, and the author may do so as an engineering owner.
The new test fails before the change and passes after it, and in Chromium a sandboxed cross-origin viewer frame logs the blocked-autofocus error before the change and nothing after it.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- Release note: the first paint leaves out
autofocus: verified (render-page.mjs:1028; the new test fails before the change and passes after it). - Release note: the page's script owns focus once it draws the page, so a field the page focuses still gets focus: verified (JSDOM case; React focuses an
autoFocusbutton, input, select or textarea when it mounts). - Release note: a viewer's cross-origin frame no longer logs a blocked-autofocus error: verified in Chromium (sandboxed
allow-scriptsframe: the error before, none after). - Description: the first paint carried React's
autofocus=""and a sandboxed frame refused it with a console error: verified (base render and Chromium). - Description: in the app there is no attribute, and React focuses the field on mount: verified (React's client never writes the attribute).
- Description: only the first-paint markup changes, quoted values are never touched, and the page's source and script are unchanged: verified (
render-page.mjs:722-728,:1028; the test keeps a value that holds the word); the theme editor's markup-only render drops the attribute too, where its pages already turnautoFocusoff. - Description: the command is experimental: verified (release-compatibility spec FR22 and FR27).
- Description: the maintainers decided that the page's script owns focus: not verified (no decision is recorded on this pull request).
- Description: the render and render-foundation test command passes: verified (304 passed, 3 browser-only cases skipped).
- Description: the change is stacked on the live-app change and lands after it: verified (the base branch is that pull request's branch).
Files:
packages/cli/foundation/render/render-page.mjs: clear; its behavior waits on the owner decision abovepackages/cli/api/render/render.interactive.test.mjs: clear.changeset/render-no-first-paint-autofocus.md: clear
20332da to
0dc1838
Compare
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the render's new focus behavior, and one description claim needs a fix.
- No current spec record says that
astryx experimental renderdropsautofocusfrom the markup it writes and leaves focus on load to the page's script, and no decision is recorded on this pull request: an engineering owner records it by commenting/approve-spec <full head SHA>(or an owner-decision comment) on the pull request, and the author may do so as an engineering owner. - Miss: The description says quoted attribute values are never touched, but
withoutAutofocus(packages/cli/foundation/render/render-page.mjs:724) skips only double-quoted values, so injected raw HTML such as<span title='press autofocus now'>paints astitle='press now'; skip single-quoted values too (with a test beside thedata-notecase), or narrow the claim to the double-quoted values React writes.
The new test fails before the change and passes after it, and in Chromium a sandboxed cross-origin frame logs the blocked-autofocus error before the change and nothing after it, with the field focused either way. GitHub lists 119 changed files because it still compares against the old base branch's last commit; this pull request's own change is one commit with three files, and the other 116 files are already on main.
Claims and files checked
Review mode: full; reason: rebase
Claims:
- Release note: the first paint leaves out
autofocus: verified (the new test fails onmainat the first-paint check and passes on this head). - Release note: the page's script owns focus once it draws the page, so a field the page focuses still gets focus: verified (JSDOM case; Chromium, same-origin and sandboxed frames).
- Release note: a viewer's cross-origin frame no longer logs a blocked-autofocus error: verified in Chromium (sandboxed frame that allows scripts: the error on
main, none on this head). - Description: the first paint carried React's
autofocus="", and a sandboxed frame refused it with a console error: verified (render onmain, Chromium). - Description: the app has no attribute, and React's client focuses the field when it mounts: verified (after the script draws, the field is focused and carries no attribute).
- Description: only the first-paint markup changes, and the page's source and script are unchanged: verified; the theme editor's markup-only render loses the attribute too, where its pages already turn
autoFocusoff. - Description: quoted attribute values are never touched: false for single-quoted values (finding above).
- Description: the command is experimental: verified (the release-compatibility record's experimental-change rules).
- Description: the maintainers decided that the page's script owns focus: not verified (no decision is recorded on this pull request).
- Description: the render and render-foundation test command passes: verified (305 passed, 3 browser-only cases skipped).
- Description scope checklist (one defect, no tagalong, no hidden public API, no internal context): verified for the three files this pull request changes.
Files:
packages/cli/foundation/render/render-page.mjs: the single-quoted value finding; its behavior waits on the owner decision abovepackages/cli/api/render/render.interactive.test.mjs: clear.changeset/render-no-first-paint-autofocus.md: clear- The other 116 files in GitHub's list: already on
mainthrough other pull requests; not part of this change
|
Owner decision (engineering owner, covering this pull request): |
|
/approve-spec ddf48f1 |
There was a problem hiding this comment.
Changes requested: one fix to the autofocus walk. The engineering-owner decision recorded on this pull request settles the render's focus behavior, and the single-quoted value fix works.
- Miss:
withoutAutofocus(packages/cli/foundation/render/render-page.mjs:723-724) reads tags with its own pattern rather thanreadTagfromhtml-reader.mjs, so raw HTML with spaces around=loses the word from a quoted value (<span title = "press autofocus now">paints astitle = "press now") and anautofocusafter a quoted>stays (<input title="a>b" autofocus>), against the description, the release note and the recorded decision that only the attribute is removed; walking start tags with the module'sscanHtml, or matching the tag quote-aware and allowing spaces around=(see the inline suggestion), with both cases added to the raw-HTML test, fixes it.
The new test and the render suites pass on this head.
Claims and files checked
Review mode: incremental; reason: none
Changed rules (0): none
Claims:
- Release note: the first paint leaves out
autofocus: verified for React's markup (test); false for raw HTML where a quoted value holding>comes before it (finding above). - Release note: the page's script owns focus once it draws the page, so a field the page focuses still gets focus: verified (the new test's drawn-page case).
- Release note: a viewer's cross-origin frame no longer logs a blocked-autofocus error: verified (Chromium, sandboxed frame; the newest commit changes only raw-HTML value handling).
- Description: the first paint carried React's
autofocus="", and a sandboxed frame refused it with a console error: verified. - Description: in the app there is no attribute, and React's client and the file's script focus the field when it mounts: verified.
- Description: only the first-paint markup changes, and the page's source and script are unchanged: verified; the theme editor's markup-only render and the docsite previews lose the attribute too.
- Description: quoted attribute values are never touched: false for a value written with spaces around
=(finding above). - Description: the command is experimental: verified (the release-compatibility record's experimental-change rules).
- Description: the maintainers decided that the page's script owns focus: verified (an engineering-owner decision is recorded on this pull request).
- Description: the evidence test checks the missing attribute, the kept
data-notevalue and the drawn page's focus: verified (passes on this head). - Description: the render and render-foundation test command passes: verified (305 passed, 3 browser-only cases skipped).
- Description scope checklist (one defect, no tagalong, no hidden public API, no internal context): verified for the three files this pull request changes.
Files:
packages/cli/foundation/render/render-page.mjs: the attribute-walk finding abovepackages/cli/api/render/render.interactive.test.mjs: clear.changeset/render-no-first-paint-autofocus.md: clear, apart from the first-paint claim the>case above makes false- The other 116 files in GitHub's list: already on
mainthrough other pull requests; not part of this change
|
/approve-spec c7524b7 |
There was a problem hiding this comment.
Changes requested: the reader-based autofocus strip fixes the earlier attribute-walk findings, but its new attribute type breaks the CLI's type build.
readTagnow returns four-item attribute entries (packages/cli/foundation/render/html-reader.mjs:40), whilenew Map(t.attrs)atrender-page.mjs:159andisSourceType(tag.attrs)atsource-block.mjs:195still expect two items, so the CLI'ssync:api-typesbuild step andtypecheck:strictfail, as CI'sbuild-storybookjob shows; casting the map entries to[string, string]and typingisSourceType's parameter asReadonlyArray<readonly [string, string, ...number[]]>fixes both.- The description's "Smallest restoration" lists only
render-page.mjsand the changeset; please add thehtml-reader.mjschange.
One rare form is worth folding into the same push: <input title=x autofocus/> paints as <input title=x/>, which a browser reads as title="x/", and skipping the whitespace walk when a / follows the cut keeps it (inline suggestion). Running pnpm -F @astryxdesign/cli typecheck before pushing catches the type errors.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Release note: the render leaves
autofocusout of the first paint, the script focuses the field, and a cross-origin frame no longer logs the error: verified (render-page.mjs:1039;render.interactive.test.mjs:221-268; the earlier cross-origin browser check). - The first paint carried React's
autofocusattribute, which a sandboxed frame refuses with a console error: verified (the earlier browser check; the test now asserts the attribute is gone). - In the app React's client focuses the field, and the file's script does the same: verified (the test's drawn page focuses the input).
- Only the first-paint markup changes; the page's source and script are unchanged: verified (
withoutAutofocusruns on the markup alone,render-page.mjs:1039). - Quoted attribute values are never touched: verified (
render.interactive.test.mjs:246-255and a before-and-after parse of 23 cases; one unquoted-value form noted above). - The command is experimental and its owners decided the script owns focus: verified (an engineering-owner decision recorded on this pull request).
- The smallest restoration is the
render-page.mjsfunction and a changeset: false,html-reader.mjsalso changes. - The test checks the markup has no
autofocus, keeps a value holding the word, and focuses the input once the script runs: verified (render.interactive.test.mjs:221-268). - No new public API, visual representation, default or interaction model: verified (no package entry point reaches the changed modules).
- The render and render-foundation test command passes: verified (18 files passed, 1 skipped; 305 tests passed).
.changeset/render-no-first-paint-autofocus.md: clear.packages/cli/api/render/render.interactive.test.mjs: clear.packages/cli/foundation/render/html-reader.mjs: finding (four-item entries break two callers' types).packages/cli/foundation/render/render-page.mjs: finding (type error at line 159; the/>form above).- The other 116 files GitHub lists come from commits already on
mainand are identical at this head: not part of this change.
|
/approve-spec 72f7883 |
There was a problem hiding this comment.
Approved pending CI: CI found no room under its ceiling and did not run the build or the tests on this head, so re-run the CI jobs before merging.
Both earlier findings are fixed: readTag's four-item entries are now typed where render-page.mjs and source-block.mjs read them, so the CLI's declaration build compiles, and the description lists the html-reader.mjs change. One rare form is worth a follow-up but does not block: <input title=a autofocus=""data-b=c> paints as <input title=adata-b=c>, and walking back over the spaces only when a space or > follows the cut covers it and the / form together (inline suggestion).
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Release note: the render leaves
autofocusout of the first paint, the script focuses the field, and a cross-origin frame no longer logs the error: verified (render-page.mjs:1042;render.interactive.test.mjs:221-273; the earlier cross-origin browser check). - A field that takes focus on mount logged a blocked-autofocus error in a viewer's sandboxed frame: verified (the earlier browser check).
- The first paint carried React's server
autofocus="", which the browser acts on while parsing: verified (React's server render of anautoFocusinput writesautofocus=""). - In the app React's client focuses the field on mount, and the file's script does the same: verified (the test's drawn page focuses the input).
- Only the first-paint markup changes, and attribute values are never touched because the tag is read with the render's HTML reader: verified (
render-page.mjs:722-742cuts only the attribute and the spaces before it; test:238-260); one parse-error form noted above. - The page's source and script are unchanged, so a field the page focuses still gets focus once the script draws: verified (the strip runs on the markup alone; the test's drawn page focuses the input).
- The command is experimental: verified (it lives under the
experimentalcommand namespace). - The maintainers decided that the page's script owns focus: verified (an engineering-owner decision recorded on this pull request, and spec approval for this head).
- The smallest restoration is the render-page function,
readTag's attribute offsets and a changeset: verified (render-page.mjs:722-742,html-reader.mjs:100; the readers' type follow-ups atrender-page.mjs:159andsource-block.mjs:167). - The test checks the markup has no
autofocus, keeps a value holding the word, and focuses the input once the script draws: verified (render.interactive.test.mjs:221-273). - One defect, no tagalongs, no new public API, visual representation, default or interaction model, and no internal context: verified (the own patch is five files; no package entry point reaches the changed modules).
- The render and render-foundation test command passes: verified (18 files passed, 1 skipped; 305 tests passed).
.changeset/render-no-first-paint-autofocus.md: clear.packages/cli/api/render/render.interactive.test.mjs: clear.packages/cli/foundation/render/html-reader.mjs: clear.packages/cli/foundation/render/render-page.mjs: non-blocking note (the parse-error form at line 734).packages/cli/foundation/render/source-block.mjs: clear.- The other 116 files GitHub lists come from commits already on
mainand are identical at this head: not part of this change.
| // written. | ||
| // Not when a `/` follows: `<input title=x/>` would read as title="x/". | ||
| let from = start; | ||
| if (markup[end] !== '/') { |
There was a problem hiding this comment.
Non-blocking: this guard keeps the spaces only when a / follows the cut, so a form with no space after a quoted value still merges an unquoted value with the next attribute: <input title=a autofocus=""data-b=c> paints as <input title=adata-b=c>, where title reads adata-b=c and data-b is gone. Walking back only when a space or > follows covers both forms and keeps every case the test lists:
if (/[\t\n\f\r >]/.test(markup[end] ?? '>')) {
while (from > token.start && /[\t\n\f\r ]/.test(markup[from - 1])) from--;
}…quoted values too
…y are read; the autofocus cut keeps a space before /
72f7883 to
260a27f
Compare
|
/approve-spec 260a27f |
There was a problem hiding this comment.
Changes requested: one fix to the pull request description. The engineering-owner decision recorded here settles the export's focus behavior, the render tests pass, and in Chromium the exported file in a sandboxed frame no longer logs the blocked-autofocus error while the field still gets focus.
- Regression: the description's "Expected behavior and authority" line still says
astryx experimental render, whichmainhas since renamed toastryx experimental exportwith no alias, so please change it to nameastryx experimental export(an edit to the description needs no new commit).
Still open and non-blocking: <input title=a autofocus=""data-b=c> paints as <input title=adata-b=c>; the earlier inline suggestion on render-page.mjs covers it.
Claims and files checked
Review mode: full; reason: rebase
- Release note: the export leaves
autofocusout of the first paint — verified (render-page.mjs:1067, render of the test page). - Release note: the page's script owns focus, so a focused field still gets focus — verified (
render.interactive.test.mjs:262-272; Chromium shows the field focused). - Release note: a cross-origin viewer no longer logs a blocked-autofocus error — verified (Chromium in a sandboxed frame: the error on
main, none here). - Description: a sandboxed-frame viewer logged the blocked-autofocus error — verified (Chromium on
main). - Description: the first paint carried React's
autofocus=""— verified (React server render probe). - Description: the app has no attribute and the script focuses the field — verified (JSDOM test).
- Description: only the first-paint markup changes; source and script stay — verified (
render-page.mjs:1067). - Description: attribute values are never touched — verified for every value's text (test
:238-260and probe); one parse-error form reparses (non-blocking). - Description: the command is experimental under the release record's isolation rule — false as written: the command is now
astryx experimental export. - Description: the maintainers decided the script owns focus — verified (owner decision on this pull request).
- Description: smallest restoration, evidence and testing command — verified (the render suites pass).
- Files:
.changeset/render-no-first-paint-autofocus.mdclear;packages/cli/api/render/render.interactive.test.mjsclear;packages/cli/foundation/render/html-reader.mjsclear;packages/cli/foundation/render/render-page.mjsnon-blocking note at:735;packages/cli/foundation/render/source-block.mjsclear.
|
/approve-spec 3983529 |
There was a problem hiding this comment.
Approved pending CI: required checks had not all finished on this head when this review was written. The description now names astryx experimental export, which fixes the one blocking finding from the last review; the engineering-owner decision recorded here settles the export's focus behavior, the render tests pass, and in Chromium the exported file in a sandboxed frame no longer logs the blocked-autofocus error while the field still gets focus.
Still open and non-blocking: <input title=a autofocus=""data-b=c> paints as <input title=adata-b=c>; the earlier inline suggestion on render-page.mjs covers it.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Release note: the export leaves
autofocusout of the first paint — verified (render-page.mjs:1067; a render of the test page on the base keeps the attribute, on this head it is gone). - Release note: the page's script owns focus, so a focused field still gets focus — verified (
render.interactive.test.mjs:262-272; Chromium shows the field focused). - Release note: a cross-origin viewer no longer logs a blocked-autofocus error — verified (Chromium, sandboxed frame: the error with the base's export, none with this head's).
- Title: the export's first paint asks for no focus and the script owns it — verified (same evidence).
- Description: a sandboxed-frame viewer logged the blocked-autofocus error — verified (Chromium with the base's export).
- Description: the first paint carried React's
autofocus=""— verified (render of the test page on the base). - Description: the app sets no attribute and the script focuses the field on mount — verified (JSDOM test; Chromium).
- Description: only the first-paint markup changes; the embedded source and the script stay — verified (
render-page.mjs:1067). - Description: attribute values are never touched — verified for every value's text (test
:238-260and a probe); one parse-error form reparses (non-blocking). - Description: the command is the experimental
exportcommand under the release record's isolation rule — verified (the experimental command group and its rename map). - Description: the maintainers decided the script owns focus — verified (owner decision on this pull request).
- Description: the restoration's files, the evidence bullet and the testing command — verified (the render suites pass: 339 tests).
- Description: scope checklist — verified (one defect, no tagalong, no new public API, no internal context).
- Files:
.changeset/render-no-first-paint-autofocus.mdclear;packages/cli/api/render/render.interactive.test.mjsclear;packages/cli/foundation/render/html-reader.mjsclear;packages/cli/foundation/render/render-page.mjsnon-blocking note at:735;packages/cli/foundation/render/source-block.mjsclear.
User impact
A rendered page with a field that takes focus when it mounts logged "Blocked autofocusing on a element in a cross-origin subframe" in a viewer that shows the file in a sandboxed frame.
Problem and solution fit
autofocus=""on the field, and the browser acts on the attribute while it parses; a sandboxed frame refuses it with a console error.The render leaves
autofocusout of the first-paint markup only. Attribute values are never touched (the tag is read with the render's own HTML reader), and the page's source and script are unchanged, so a field the page focuses still gets focus once the script draws the page.Expected behavior and authority
astryx experimental exportis experimental (spec:AST-017FR27). The maintainers decided that the page's script owns focus.Smallest restoration
foundation/render/render-page.mjs:withoutAutofocuson the first-paint markup.foundation/render/html-reader.mjs:readTaggives each attribute's start and end offsets beside its name and value, so a caller can cut an attribute out of the tag's text.Evidence
api/render/render.interactive.test.mjs: the markup's input has noautofocusattribute (adata-notevalue that holds the word stays), and in JSDOM the drawn page focuses the input as the app does.Scope
Testing
pnpm exec vitest run --project node packages/cli/api/render packages/cli/foundation/render.