Skip to content

fix(site): copy the playground link in Safari, and keep the Apply all row in place - #249

Merged
dgesteves merged 2 commits into
mainfrom
fix/os-200-polish-playground-copy-cls
Oct 28, 2026
Merged

dgesteves merged 2 commits into
mainfrom
fix/os-200-polish-playground-copy-cls

Conversation

@dgesteves

@dgesteves dgesteves commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

The polish left from the review of #200. Site only, no changeset. Roadmap item: os-200-polish.

What was wrong

What changed

A side effect of keeping the row: after "Apply all", the pressed button stays visible but disabled until the check returns, then goes away. Before, it went away at once. Focus still moves to the summary, as before. The findings list changes at that same moment anyway, because the fixed findings drop out of it.

How it was tested

New file site/test/playground-share.test.ts, 4 tests. All 4 fail on main, where neither copyText nor ApplyAll exists, and pass on this branch:

  • The clipboard write starts before the link's promise resolves, and the copied text is the URL.
  • Without ClipboardItem it falls back to writeText. It rejects when the browser refuses the write, and when there is no clipboard at all.
  • The row's text is the same stale and fresh, and the button is disabled only when stale.
  • There is no row when no finding has a fix.

CLS while opening a #code= link (the first draft plus one comment line). I measured it with a Playwright PerformanceObserver (layout-shift, inputs excluded) in Chromium at 1440 x 900, against next start on a local production build, 5 runs each:

Run 1 Run 2 Run 3 Run 4 Run 5
main 0.0399 0.0399 0.0399 0.0001 0.0399
this branch 0.0029 0.0029 0.0001 0.0029 0.0029

At 375 px, the branch measured 0.0000 in 5 runs. What is left at 1440 px (two shifts of 0.0014) is not the row. The status in the editor bar changes width (the error and warning count, then "Checking…"), so it moves sideways, and the error marks in the code are redrawn. The 0.0001 is the page heading moving 3 px. WebKit does not report layout-shift entries, so there are no WebKit CLS numbers.

Copy link, in Playwright Chromium (clipboard read back) and WebKit (live region read). Each was tested with the link ready and with a click straight after an edit, with link compression slowed by 300 ms so the click lands first. Both cases copy the right URL on this branch. With the clipboard write made to fail, main's live region stays empty and this branch announces the failure, in both engines. Playwright's WebKit does not enforce Safari's rule about writes after an await, since main copies there too. So the Safari fix rests on the ClipboardItem pattern page-actions.tsx already uses, and on the test that the write starts during the click.

I also checked in Chromium at 1440 px and WebKit at 375 px: while typing, the row stays disabled and faded; after the check, it is enabled again. After Apply all, focus moves to the summary and the row goes away once no fix is left.

Gate:

  • pnpm install --frozen-lockfile --prefer-offline: ok
  • pnpm format:check, pnpm lint, pnpm typecheck: clean
  • pnpm test: 102 files and 1290 tests passed, 1 file and 3 tests skipped
  • pnpm build: ok, publint found no issues
  • pnpm --filter site generate, test, typecheck, lint, build: ok. The site tests ran 21 files and 288 tests.

Not in this PR

  • The editor bar's status changing width while a check runs, the last 0.0014 shifts above.

… row in place

Copy link starts the clipboard write in the click, with the link as a
promise in a ClipboardItem, as Copy page does: Safari refused the
writeText that ran after the link was worked out. When the write fails,
the status says the link is in the address bar.

While edited code is checked again, the "Apply N fixes" row keeps the
last result's counts with its button off, as the findings below do,
instead of going and coming back. Opening a #code= link at 1440 px
shifted the findings by 41 px twice (CLS 0.0399, now 0.0029).

Tests: drop the touch-target test small-screens.test.ts repeated, and
check ask.tsx and site-menu.tsx in polish.test.ts. ROADMAP: #200 is
merged, and "Open in playground" on rule pages is next.
#201 shipped in 0.9.1, #202 in 0.10.0 and #199 in 0.10.1, as the
changelog shows; #200, #203 and #204 are website and docs changes, live
since they merged. Main is at 0.10.1 with no pending changesets, so
nothing is merged and waiting for a release. In review now lists the
open pull requests #241 and #242.
@dgesteves
dgesteves merged commit 0b558b9 into main Oct 28, 2026
17 checks passed
@dgesteves
dgesteves deleted the fix/os-200-polish-playground-copy-cls branch October 28, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant