Skip to content

chore(internal): manual real-Safari check for BottomSheet stacking, replace and non-modal hosting - #8297

Merged
imdreamrunner merged 1 commit into
mainfrom
chore/bottom-sheet-safari-harness
Oct 27, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
chore/bottom-sheet-safari-harness

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

BottomSheet's stacking, replace handoff, non-modal popover hosting, toast order and focus return are real-browser behaviour that Linux CI cannot witness in Safari: Chromium and Playwright's WebKit run there, Safari does not, and spec:AST-013 FR10 counts only real Safari as Safari evidence (Chromium and Playwright WebKit cannot stand in for a Safari claim). Until now the evidence for those paths came from a script that lived inside the stacking pull request itself, so anyone wanting to repeat a run had to check out that branch, and the script's 658 lines inflated a product change it is not part of.

Intended invariant

spec:AST-027 FR8 (interactive layered surfaces live in the top layer), spec:AST-013 FR10 (Safari claims need real Safari), and component:BottomSheet's verification map — whose FR5–FR11 Safari rows are proposed in #7648 and its record pull request #8010, not current on main; this script is the tool those rows will name once they are. Nothing about the product changes: this pull request adds a person-run script under internal/scripts/ and documents it. No package, template or story is touched.

Change

Adds internal/scripts/bottom-sheet-safari-check.mjs and its row and section in internal/scripts/README.md. The script drives Safari through safaridriver's W3C WebDriver endpoint with plain fetch (no dependencies, Node ≥ 20) against a deployed Storybook, at 390×844: it samples the page dim and the open dialogs per animation frame inside one executeAsync call, hit-tests toasts and the top sheet, and writes <label>-results.json, <label>-summary.md and screenshots, exiting 1 when a check fails. Every check records pass, fail, skipped or not-driven: a story the deployment lacks is skipped — together with every check that story carries (the Escape-only-top-sheet, tooltip and focus-return rows), so the table never drops a row — and the lone no-scrim focus-return row first moves focus into the sheet and records not-driven when Safari leaves it outside, so a sheet that never took focus cannot pass as a return; every check has one name whether it runs or is skipped; the Escape row passes only when the former top sheet is the one that left and every sheet beneath is still presented; the replace rows grade focus on the 1 → 2 sample, inside the entering step's dialog alone, as part of their status, and their note prints that graded value; a step that throws fails each row it owns, with the error, instead of adding a row under the step's name; the per-frame sampler is scheduled before the driving action runs, so its first sample is the first frame after the click and a handoff's opening frames — including the 150 ms before a fast Back — are in the record; the run label is flattened for file names (/, \, spaces and other unsafe characters become -), so a branch name such as feat/x no longer fails every write with a missing directory; the README says every run against current main exits 1 (its show() host fails the hosting row and, with it, the no-scrim focus-return and replace rows that depend on top-layer hosting), and the sampler comment says what it does: its first sample is the first frame after the click; a sheet action (clickButton(..., 'top')) is scoped to the presented top sheet and never falls back to the document, so the toast-order row records not-driven when no sheet is presented after Open sheet instead of clicking a button inside a closed dialog; the sampler now returns the driving action's own outcome beside the frames, and the replace rows record whether the fast Back was pressed — the 1 → 2 handoff they measured is graded first (a failed handoff is fail), and only a passing 1 → 2 half with no Back button found is not-driven, never a pass on that half alone — and a check Safari's WebDriver cannot drive reliably (hover) is not-driven, never faked — noted as "not driven in Safari (hover is unreliable in safaridriver)", since Chromium and Playwright WebKit cannot stand in for a Safari claim (spec:AST-013 FR10). When the Storybook index itself cannot be read (a wrong base URL, a missing /storybook segment, a login page) the run fails with exit 1 instead of recording every check as skipped. The non-modal hosting row requires :popover-open and not :modal, so a show() host fails it. Output defaults to internal/scripts/output/safari/, under the directory git already ignores.

It belongs in maintenance because it ships nothing and changes no behaviour: it is evidence tooling, separable from the change it measures. Dependency note: the stacking and replace stories it drives (core-bottomsheetstacking--*, core-bottomsheetreplace--*) ship with the open-order stacking pull request (#7648); on today's main those checks are recorded as skipped and the switcher and no-scrim checks still run. The header comment and the README say so.

Evidence

  • Failure before the change: no way to produce or repeat real-Safari evidence for the BottomSheet stacking paths from main; the script existed only on the stacking branch.
  • Success after the change: node internal/scripts/bottom-sheet-safari-check.mjs <storybook base URL> <label> [out dir] with safaridriver --port 4799 running writes results, summary and screenshots. Against the stacking branch's deployment the three runs quoted in feat(core): BottomSheet stacks by open order, replaces on a same-update switch, and BottomSheetSwitcher is deprecated #7648 came from this script (run 3: 11 of 11 drivable checks pass, 1 not driven, Safari 27.0.1 on macOS); against a deployment of main the stacking and replace checks are skipped and the rest run.
  • Product/runtime behavior verified unchanged: the diff touches internal/scripts/ only (git diff --stat origin/main: the script, the README, the directory's .gitignore comment); no package, story, template or record changes.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

node --check internal/scripts/bottom-sheet-safari-check.mjs           ✓
prettier --check internal/scripts/bottom-sheet-safari-check.mjs internal/scripts/README.md   ✓
(the repository's ESLint config ignores `.mjs` files outside packages/cli, so the script is not linted; `node --check` and prettier cover it)
pnpm check:repo                                                       ✓

Manual run (a Mac with Safari ▸ Develop ▸ Allow Remote Automation enabled):

safaridriver --port 4799 &
node internal/scripts/bottom-sheet-safari-check.mjs https://<deployment>/storybook main

macOS Safari evidence informs but does not satisfy an iOS Safari claim (spec:AST-013); the script says so in its summary.

@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 25, 2026 7:39pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 25, 2026, 7:58 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This split-out Safari harness changes no product behaviour, but two of its checks can report success when they should not, so please fix them before the script is used as evidence.

  • The non-modal hosting (lone NoScrim) row (line 270) passes any dialog that is not :modal, so main's dialog.show() host reports pass when only a :popover-open dialog that is not :modal should.
  • When index.json cannot be read, every check is recorded as skipped and the run exits 0, but that case should fail the run.

Three smaller fixes are also worth making: the usage line names safari-check.mjs, the tooltip note says the check is "covered by Chromium and WebKit runs", and the README row leaves out skipped.

[Automated review]

const shot = await screenshot('nonmodal-lone-open');
const d = state[0];
record('non-modal hosting (lone NoScrim)', {
status: !d ? 'fail' : d.modal === false ? 'pass' : 'fail',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This passes any dialog that is not :modal, so a dialog.show() host (today's main, at z-index: 1000) passes exactly as a :popover-open host does. The row is offered as evidence of popover (top-layer) hosting under spec:AST-027 FR8, and #7648's table defines it as ":popover-open, not :modal". Suggest:

status: d && d.popoverOpen && d.modal === false ? 'pass' : 'fail',

Alternatively, give the show() fallback a status of its own where showPopover is absent.

console.log(` window: ${JSON.stringify(results.window)}`);

await navigate(`${baseUrl}/iframe.html`);
const entries = (await storyExists()) ?? [];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If index.json can't be fetched or parsed (a wrong base URL, a missing /storybook segment, a login page), storyExists() returns null. This line then turns it into [], every check is recorded as skipped, and the run exits 0. Consider failing the run when the index is unreadable, and keeping skipped for stories that are genuinely absent from a readable index.

// Tooltip from the sheet: hover is not reliably drivable in Safari WebDriver.
record('tooltip/popover opened from the sheet above it', {
status: 'not-driven',
note: 'hover/pointer actions are not reliable in safaridriver; covered by Chromium and WebKit runs',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-013 FR10 says Chromium and Playwright WebKit can't stand in for a Safari claim, so "covered by Chromium and WebKit runs" overstates what those runs give a Safari reader. Maybe: "not driven in Safari (hover is unreliable in safaridriver)".

] = process.argv.slice(2);
if (!baseUrlArg) {
console.error(
'usage: node safari-check.mjs <baseUrl> <label> <outDir> [driverUrl]',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage line names safari-check.mjs; the file is bottom-sheet-safari-check.mjs.

const [
baseUrlArg,
label = 'run',
outDirArg = './safari-out',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run from the repository root as the README shows, ./safari-out lands in the tree, and nothing ignores it. The Crowdin script's output/ is ignored by internal/scripts/.gitignore. An ignore entry, or a default under an ignored path, would keep run outputs out of commits.

Comment thread internal/scripts/README.md Outdated
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `upload-crowdin-screenshots.mjs` | Build storybook, capture in-context screenshots for i18n catalog keys, upload to Crowdin, and POST tag positions so each screenshot pixel-links to the matching source string. |
| `lib/crowdin-strategies.mjs` | Declarative measurement strategies (visibleText, textRun, option, placeholder, ariaLabel, chipOperator, filterInput, footerButton, srOnlyLabel, srOnlyReveal, liveRegionReveal) used by the upload script to resolve tag coordinates. |
| `bottom-sheet-safari-check.mjs` | Manual real-Safari check (W3C WebDriver over `safaridriver`, no dependencies) for BottomSheet stacking, replace, non-modal popover hosting, toast order and focus return against a deployed Storybook; prints a pass/fail/not-driven table and writes JSON + screenshots. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script also records skipped, and the section below says so; "prints a pass/fail/skipped/not-driven table" would match.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the script changes no product behaviour, and its hosting row and story-index guard now grade as described. Two small follow-ups would make its output and the description exact:

  • When a story is absent, also record its dependent checks (Escape closes only the top sheet, the tooltip row and the focus-return rows) as skipped, so the summary keeps the "every check records" promise in the script header and README.
  • In the description, the real-Safari rule is spec:AST-013 FR10 (FR11 covers raising the floor), and the component:BottomSheet FR5–FR11 Safari rows are proposed in #7648 rather than current on main.

[Automated review]


async function checkStacking(ids) {
const id = ids.ordersDrillIn;
if (!id) return skipped('covered sheets inert + aria-hidden', 'story absent');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the stacking story is absent, this returns before Escape closes only the top sheet (line 475) is recorded, so that row disappears from the summary instead of reading skipped, as line 21 and the README promise. The early returns at lines 261, 313 and 393 drop the lone focus-return, flow focus-return and tooltip rows the same way. Suggest:

if (!id) {
  skipped('covered sheets inert + aria-hidden', 'story absent');
  return skipped('Escape closes only the top sheet', 'story absent');
}

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This person-run Safari harness changes no product behaviour, but one of its rows can still report a check it never made, so please fix it before the script is used as evidence.

  • focus return: lone no-scrim sheet, Escape (lines 300–306) looks only at where focus ends, so a sheet that never takes focus closes on Escape with focus still on "Open sheet" and reads pass; grade it on d.hasFocus (or move focus into the sheet first) and record not-driven otherwise.
  • The deep-link row is deep link re-shown dialog order when skipped (line 559) and deep link re-shown dialog order (depth three) when run (line 580), so a main table and a #7648 table list it as two checks; one name keeps them aligned.

[Automated review]

Comment on lines +300 to +306
record('focus return: lone no-scrim sheet, Escape', {
status:
after.open === 0
? after.active.includes('"Open sheet"')
? 'pass'
: 'fail'
: 'fail',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This grades only where focus ends. Escape reaches the sheet through the layer stack's document listener wherever focus is, so a sheet that never took focus closes with focus still on "Open sheet" and this row reads pass with nothing returned. A fixture sheet whose host moves no focus on open reproduces it: focusBeforeEscape and focusAfterClose are both button"Open sheet" on page, status pass. d.hasFocus from the hosting row already says whether focus entered:

status:
  after.open !== 0 ? 'fail'
  : !d?.hasFocus ? 'not-driven' // focus never entered the sheet: nothing returned
  : after.active.includes('"Open sheet"') ? 'pass' : 'fail',


async function checkDeepLink(ids) {
const id = ids.deepLink;
if (!id) return skipped('deep link re-shown dialog order', 'story absent');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipped, this row is deep link re-shown dialog order; run, it is deep link re-shown dialog order (depth three) (line 580). A main table and a #7648 table then list it as two different checks. One name in both places keeps the rows aligned.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This person-run Safari harness changes no product behaviour, and the lone focus-return and deep-link fixes work as described, but one stacking row can still pass without checking what it names, so please fix it before the script is used as evidence.

  • Escape closes only the top sheet (lines 515–519) passes whenever one sheet fewer is open, so a sheet whose Escape closes the covered sheet instead of the top one reads pass; also require that the top sheet (top.top) is the one that closed.
  • Smaller: focusIntoEnteringStep (lines 375–377) is not part of the replace rows' status, and its test also matches the exiting step's panel; grade it on the 1→2 sample or drop it.

[Automated review]

);
record('Escape closes only the top sheet', {
status:
state.length >= 2 && afterEsc.dialogs.length === state.length - 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This passes whenever one sheet fewer is presented, without checking which one closed. Against a fixture whose Escape closes the covered "Orders" sheet and leaves "Order 1042" on top, the row reads pass (2 → 1, before: ["Orders", "Order 1042"], after: ["Order 1042"]). top.top already names the top sheet:

status:
  state.length >= 2 &&
  afterEsc.dialogs.length === state.length - 1 &&
  !afterEsc.dialogs.some(d => d.label === top.top)
    ? 'pass'
    : 'fail',

inPage(`return {dialogs: dialogState(), active: describeActive()};`),
);
const enteringFocused =
/panel|in Notification frequency|in How often/.test(s12.activeLast ?? '') ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: /panel|…/ also matches div (panel) in Set up notifications (the exiting step), the settled.dialogs[0]?.hasFocus fallback reads the state after the fast Back rather than the 1→2 entry, and the field is not part of the row's status. Matching only the entering step's dialog on s12.activeLast (for example / in Notification frequency$/) and folding it into status, or dropping the field, keeps it from reading pass when focus never entered.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the harness ships nothing, and its Escape and replace rows now grade what they name. Two optional touch-ups: the replace rows' note (bottom-sheet-safari-check.mjs:398) prints focus after the fast Back while their status grades focus after the 1 → 2 handoff, so a passing no-scrim row can read focus body; and the description's ESLint line reports a file the lint config ignores (every .mjs outside packages/cli). The Safari runs quoted in #7648 do not name the harness revision behind them, so a fresh run with this revision would keep that table current.

[Automated review]

settledAfter: settled,
focusIntoEnteringStep: enteringFocused ? 'pass' : 'fail',
focusAfter1to2: s12.activeLast ?? null,
note: `dim 1→2 ${s12.dimMin}..${s12.dimMax}, fast Back ${sRev.dimMin}..${sRev.dimMax}; open dialogs max ${s12.openDialogsMax}/${sRev.openDialogsMax}; settled ${settled.dialogs.map(d => d.label).join(', ')}; focus ${settled.active}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: the note ends with focus ${settled.active}, focus after the fast Back, while the status grades focusAfter1to2 (line 397), which only the JSON carries. On main's no-scrim switcher story the summary then reads pass … focus body although focus did enter Notification frequency after 1 → 2. Printing the graded value too keeps a pasted summary unambiguous, for example …; focus after 1→2 ${s12.activeLast}; after fast Back ${settled.active}.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the harness ships nothing, and its hosting, replace and focus-return rows grade what they name. Two optional fixes would tighten its output: a step that throws (for example, a stacking story that opens no sheet) records one fail under the step's name instead of its named rows (bottom-sheet-safari-check.mjs:691–699), and the fast-Back sample starts only after Back is clicked, which leaves the first 150 ms of the 2 → 3 handoff unsampled (line 239). The Safari runs quoted in #7648 name no harness revision (that description puts the harness at 658 lines), so a fresh run with this revision would keep that table current.

[Automated review]

try {
await run();
} catch (error) {
record(name, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: when a step throws, this records one row under the step's name (stacking + Escape, close all, deep link), and that step's named rows never appear, so the summary no longer keeps the header's "Every check records {status: …}" promise or lines up with a full run. A page whose stacking story opens no sheet reproduces it: qa('button', d) (lines 488, 557) and panelOf(d) (line 615) throw when topDialog() is null. Recording each row the step has not yet recorded as fail with the error keeps the table aligned, for example:

} catch (error) {
  // STEP_ROWS maps each step to its row names, e.g. 'stacking + Escape' to its two rows
  for (const row of STEP_ROWS[name] ?? [name])
    if (!(row in results.checks))
      record(row, {status: 'fail', error: String(error.message ?? error).slice(0, 400)});
}

frames.push({rel: Math.round(performance.now() - start), dim: Math.round(dim * 1000) / 1000, backdrops: ds.map(d => [label(d), d.matches(':modal') ? backdropOpacity(d) : 0]), pageHit: hitAt(area.x, area.y), active: describeActive(), panels});
if (performance.now() - start < ${ms}) requestAnimationFrame(sample); else done(frames);
};
(async () => { ${actionJs} })().then(() => requestAnimationFrame(sample)).catch(e => done({error: String(e)}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: sampling starts only when the action resolves, and the fast-Back action waits 150 ms before it clicks Back (lines 366–367), so the first 150 ms of the 2 → 3 handoff are never sampled, although the comment at line 220 says the helper samples "through an interaction". Starting the frame loop before awaiting the action covers that window:

requestAnimationFrame(sample);
(async () => { ${actionJs} })().catch(e => done({error: String(e)}));

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the Safari harness ships nothing, and its hosting, replace, focus-return and thrown-step rows grade what they name. One optional fix: a label containing / (the header offers a branch name as an example, line 16) makes every screenshot and the final results write fail with ENOENT, so the run ends with nothing saved; refusing or flattening such a label before the session opens would prevent that. The Safari runs quoted in #7648 came from an earlier revision of the script, so a fresh run with this one would keep that evidence current.

[Automated review]

wd('POST', `${S()}/execute/async`, {script, args});
const screenshot = async name => {
const b64 = await wd('GET', `${S()}/screenshot`);
const file = path.join(outDir, `${label}-${name}.png`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A label containing / (line 16 offers a branch name as an example, and this branch is chore/bottom-sheet-safari-harness) turns this into a path under a directory that does not exist, so every screenshot throws ENOENT, the step's rows print fail with no reason, and the results write at lines 742–745 ends the run with nothing saved. Refusing such a label right after the argument check would avoid it, for example:

if (/[\\/]/.test(label)) {
  console.error('label must be a single file-name segment, e.g. main');
  process.exit(2);
}

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the Safari harness ships nothing, its rows grade what they name, and a branch name now works as the run label. Two optional touch-ups would make its output easier to read: say in the description or README that every run against main exits 1 (its dialog.show() host fails the hosting row in any engine), and word the sampler comment at bottom-sheet-safari-check.mjs:247 so it says the first sample is the first frame after the click. The Safari runs quoted in #7648 are labelled by that pull request's revisions rather than this script's, so a fresh run with this revision would keep that evidence current.

[Automated review]

frames.push({rel: Math.round(performance.now() - start), dim: Math.round(dim * 1000) / 1000, backdrops: ds.map(d => [label(d), d.matches(':modal') ? backdropOpacity(d) : 0]), pageHit: hitAt(area.x, area.y), active: describeActive(), panels});
if (performance.now() - start < ${ms}) requestAnimationFrame(sample); else done(frames);
};
// Sample from the frame before the action runs, so a handoff's first

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: requestAnimationFrame(sample) queues the first sample for the next frame, and the action below runs its click synchronously before that frame, so no sample precedes the click (on a Chromium stand-in the first 1 → 2 sample, at 23 ms, already has Notification frequency presented). The 150 ms before a fast Back are covered, as intended; wording it as "queue the sampler before the action starts, so the first frame after the click …" would match what the record holds.

Comment thread internal/scripts/README.md Outdated
node internal/scripts/bottom-sheet-safari-check.mjs <storybook base URL> <label> [out dir]
```

Each run writes `<label>-results.json` (every per-frame sample), `<label>-summary.md` and screenshots to the out dir (the label is flattened for file names first: `/`, `\`, spaces and other unsafe characters become `-`, so a branch name works as given) (default `internal/scripts/output/safari/`, which git ignores), exits 1 if a check fails, and exits 1 without running when the Storybook index cannot be read (a wrong base URL). A story the deployment lacks is recorded as `skipped` — the stacking and replace stories (`core-bottomsheetstacking--*`, `core-bottomsheetreplace--*`) ship with the open-order stacking change and are skipped on a deployment without it, where the switcher and no-scrim checks still run; a check Safari's WebDriver cannot drive reliably (hover) is `not-driven`, never faked; when a step throws, each check that step owns is recorded as `fail` with the error, so the table keeps its shape. macOS Safari evidence informs but does not satisfy an iOS Safari claim (spec AST-013).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: on a deployment of main the hosting row always fails, because main's lone no-scrim sheet is a dialog.show() host rather than :popover-open, so every main run exits 1. Saying so here would keep a main run used as the before state from reading as a broken harness.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: this Safari harness ships nothing, its rows grade what they name, and the README now explains that a run against main exits 1 because its dialog.show() host fails the hosting row. One optional follow-up before #7648 or #8010 cite it: the Safari runs quoted in #7648 came from an earlier revision of the script, so a fresh Safari run with this revision would keep that evidence current. The description's line that sampling "starts the frame before the driving action runs" could also match the reworded code comment, which says the first sample is the first frame after the click.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: two rows of this Safari check can report a check they never made. toast order over a non-modal sheet (lines 460–471) never confirms a sheet opened, and clickButton('Toast from sheet', 'top') falls back to the whole document, so if Open sheet opens nothing it clicks the button inside the closed dialog and reads pass; the replace rows likewise pass when the fast Back finds no Back button (line 380), since their status never asks whether it was clicked. Please make each of these rows read fail or not-driven when its action did not happen. Optionally, the README's explanation of why a main run exits 1 could also name the no-scrim focus rows, which #7648's Safari table shows failing on main.

[Automated review]

const fRev = await sampleThrough(
`const c = buttonIn(topDialog(), 'Continue'); c.focus(); c.click();
await new Promise(r => setTimeout(r, 150));
const back = buttonIn(topDialog(), 'Back'); if (back) { back.focus(); back.click(); }`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The row's status never asks whether this click happened: when no Back is found 150 ms after Continue (a renamed button, or a step without one), the reversal is skipped silently and the row can still read pass — … fast Back 0.5..0.5 … while the flow settles on the next step. Recording whether Back was clicked and reading fail (or not-driven) when it was not would keep the row honest about the fast Back it names.

Comment on lines +467 to +471
const ok =
sheetOpen.length > 0 &&
sheetOpen.every(t => t.hitsToast) &&
whileOpen.length > 1 &&
whileOpen.every(t => t.hitsToast);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This row never checks that a sheet is presented. If Open sheet opens nothing (a renamed button, a story change, or a sheet that fails to open), clickButton('Toast from sheet', 'top') falls back to document (line 220) and clicks the button inside the closed <dialog>, which BottomSheet keeps mounted; both toasts then hit-test to themselves and the row reads pass — raised before: above; raised while open: above,above, with exit 0 when nothing else fails. Reading topDialog() after line 460 and recording fail (or not-driven, "sheet did not open") when it is null, and looking up Toast from sheet only inside that dialog, would keep the row from passing without the sheet it names.

Comment thread internal/scripts/README.md Outdated
node internal/scripts/bottom-sheet-safari-check.mjs <storybook base URL> <label> [out dir]
```

Each run writes `<label>-results.json` (every per-frame sample), `<label>-summary.md` and screenshots to the out dir (the label is flattened for file names first: `/`, `\`, spaces and other unsafe characters become `-`, so a branch name works as given) (default `internal/scripts/output/safari/`, which git ignores), exits 1 if a check fails — so every run against current `main` exits 1: its `show()` host fails the non-modal hosting row, which is the gap the stacking change closes — and exits 1 without running when the Storybook index cannot be read (a wrong base URL). A story the deployment lacks is recorded as `skipped` — the stacking and replace stories (`core-bottomsheetstacking--*`, `core-bottomsheetreplace--*`) ship with the open-order stacking change and are skipped on a deployment without it, where the switcher and no-scrim checks still run; a check Safari's WebDriver cannot drive reliably (hover) is `not-driven`, never faked; when a step throws, each check that step owns is recorded as `fail` with the error, so the table keeps its shape. macOS Safari evidence informs but does not satisfy an iOS Safari claim (spec AST-013).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: main fails more than the hosting row. #7648's Safari table records focus on body after the lone sheet's Escape and after a no-scrim switch on main, which this revision grades as fail in focus return: lone no-scrim sheet, Escape and replace handoff (no-scrim). Naming those rows here too would keep a main run used as the before state from reading as a broken harness.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the toast row now reads not-driven when no sheet is presented, and the replace rows when the fast Back finds no Back button, so neither can pass without its action. One optional fix: those replace rows decide not-driven before grading the 1 → 2 handoff they did measure (bottom-sheet-safari-check.mjs:423-427), so a step without Back turns a failed handoff into not-driven, which does not fail the run; grading the 1 → 2 half first would keep it a fail. The Safari runs quoted in #7648 came from an earlier revision of the script, so a fresh Safari run with this one would keep that evidence current.

[Automated review]

Comment on lines +423 to +427
const status = !backPressed
? 'not-driven'
: dimOk && oneLeft && enteringFocused
? 'pass'
: 'fail';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: not-driven is decided before the measured 1 → 2 half is graded, so when Back is missing a 1 → 2 handoff that failed (dim out of range, or focus not inside the entering step) reads not-driven and the run can exit 0. A three-step fixture whose handoffs leave focus on body and that has no Back reads not-driven … focus after 1→2 body (not inside the entering step) here, and fail on the previous revision. Grading the 1 → 2 half first keeps that failure:

const dim12Ok =
  kind === 'modal' ? s12.dimMin >= 0.49 && s12.dimMax <= 0.51 : s12.dimMax === 0;
const status = !(dim12Ok && enteringFocused)
  ? 'fail'
  : !backPressed
    ? 'not-driven'
    : dimOk && oneLeft ? 'pass' : 'fail';

…eplace and non-modal hosting

A person-run harness that drives Safari through safaridriver's W3C WebDriver
endpoint with plain fetch (no dependencies) against a deployed Storybook, and
records per-frame samples, a summary and screenshots for the BottomSheet
stacking, replace, non-modal popover hosting, toast order and focus checks —
the real-Safari evidence Linux CI (Chromium, Playwright WebKit) cannot produce.
Ships nothing: internal/scripts only, plus its README row and section.

Stories the deployment lacks are recorded as skipped: the stacking and replace
stories ship with the open-order stacking change, so on main today those
checks skip and the switcher and no-scrim checks run.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the script ships nothing, no row can pass without the action it names, and the replace rows now grade the measured 1 → 2 handoff before the fast-Back guard, so a failed handoff stays a fail. One optional follow-up: the Safari runs quoted in #7648 were made with an earlier revision of the script, so a fresh Safari run with this revision would keep that evidence current before #8010's verification rows cite it.

[Automated review]

@imdreamrunner
imdreamrunner marked this pull request as ready for review October 27, 2026 16:52
@imdreamrunner
imdreamrunner merged commit d7bf667 into main Oct 27, 2026
66 checks passed
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…eta#8297, meta#8650, meta#8672) into meta#8203

# Conflicts:
#	packages/core/src/BottomSheet/BottomSheet.tsx
@github-actions
github-actions Bot deleted the chore/bottom-sheet-safari-harness branch October 28, 2026 06:17

This branch was successfully deployed

1 active deployment
Preview — 70bf3ab3 Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant