Repository navigation
fix(ui): preserve newer selection after native Share (YPE-6812) - #494
Conversation
🦋 Changeset detectedLatest commit: cc796aa The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@greptileai review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
cameronapak
left a comment
There was a problem hiding this comment.
Review
Summary
Standards: 0 must-fix. Spec: 0 must-fix. Primary concern: none.
Review evidence
- Scope: cc796aa, compared with declared base f4a3ddb. Reviewed all three changed files, YPE-6812 and its acceptance criteria, pinned repository guidance, and existing discussion. HEAD and base are unchanged before submission.
- Method: separate Standards, Spec, and Correctness passes, plus a bounded reuse check. Traced immutable selection updates in verse.tsx, navigation and explicit-clear invalidation, and the Share completion guard in bible-reader.tsx. Cancellation/failure, host onShare, clipboard fallback, and direct user-action invocation remain unchanged by source inspection. The fix reuses existing refs without a new abstraction.
| Behavior or check | Method / command | Result | Evidence source |
|---|---|---|---|
| Reader selection and highlight workflows | vitest run --project unit src/components/bible-reader-controlled.test.tsx | 50 passed | Reviewer-run at pinned HEAD |
| Regression sensitivity | In an isolated scratch checkout, restore the exact base Share handler and run the same file with -t 'native Share completion' | Three changed-selection cases fail; unchanged-selection and navigation-without-selection controls pass | Reviewer-run |
| Restored fix | Restore HEAD and rerun the five native Share completion cases | 5 passed; 45 unrelated tests skipped by filter | Reviewer-run |
| Full unit coverage | Repository CI Test job | UI: 627 passed; hooks: 200 passed; core: 352 passed, 2 skipped | CI at reviewed HEAD |
- Limits: no independent native Share sheet, Safari, or mobile exercise; native timing evidence is author-reported. The full monorepo suite was not rerun locally. The initial pnpm command in the linked scratch checkout refused module relinking; invoking the installed Vitest binary directly recovered successfully.
- CI and bot review: build, lint, typecheck, integration, and shadow-browser checks passed. Older red release entries belong to a canceled run; the later release workflow passed at the same SHA. Greptile and Codex report no findings; there are no existing review threads.
- Event: APPROVE.
Written by Code Reviewer bot on behalf of Cam.
| expect(lastSelection(onVerseSelect)).toMatchObject({ chapter: '1', verses: [2] }); | ||
| } else if (scenario === 'reselected same verse') { | ||
| selectVerse(view.container, 1); | ||
| selectVerse(view.container, 1); |
There was a problem hiding this comment.
praise: The same-verse reselection case catches a value-equality guard that would incorrectly clear a newer selection.
For Agents: selection identity regression
Deselecting and reselecting verse 1 produces the same verse numbers but a new selection identity. This case checks that Share completion preserves both the selected verse and its popover without emitting a clear event. Restoring the old handler makes this case fail; the current guard passes.
Written by Code Reviewer bot on behalf of Cam.
7ce0341
into
feat/after-thanksgiving-merge
* chore: sync react localization from platform-localization (#478) chore: sync react localization Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com> * fix(core): sanitize planted footnote content in Bible HTML (#486) * fix(core): sanitize planted footnote content in Bible HTML Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com> * fix(core): address review on footnote sanitization Sanitize footnote content in an inert template, drop non-HTML-namespace elements, sanitize generated footnote content for idempotency, document the sanitization contract, and consolidate tests. Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(ui): organize Bible reader modules (#489) * refactor(ui): organize Bible reader modules (YPE-6808) * refactor(ui): extract reader settings lifecycle and toolbar (#495) * refactor(ui): extract reader settings lifecycle and toolbar (YPE-6815) * fix(ui): address reader settings review feedback * feat(ui): re-export passage and versions hooks (#500) * feat(ui): re-export passage and versions hooks Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7 * chore(ci): remove packed UI consumer check * docs(ui): clarify shared provider import guidance Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7 * docs: address hook re-export review nits Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7 --------- Co-authored-by: Amp <amp@ampcode.com> * fix(ui): preserve focus at high zoom (#485) * fix(ui): preserve focus at high zoom * fix(ui): harden zoom focus coverage * refactor(ui): simplify zoom focus handling * test(ui): cover zoom focus behavior * test(ui): focus reader close before asserting * fix(ui): address zoom review findings * test(ui): compare pointer focus styles * test(ui): respect focus-visible heuristics * test(ui): use native focus traversal * fix(ui): scope focus preservation * fix(ui): preserve sign-in focus contrast * test(ui): await close focus transition * refactor(ui): centralize picker scroll geometry * fix(ui): keep picker focus visible in constrained panels * fix(ui): preserve the expanded book trigger in compact panels * test(ui): reach reader settings close with native keys * fix(ui): honor reduced motion in chapter reveal * fix(ui): address focus and scroll review feedback * fix(ui): reveal focused chapters in Firefox Keep focused book triggers fully visible within the built-in accordion on Linux Firefox. Wait for the settings dialog opening animation before asserting visibility in WebKit. * test(ui): query the current settings dialog while opening * feat(core): add Content Library video APIs (YPE-6573) (#488) * feat(core): add content library video APIs * refactor(core): simplify video schema ownership * fix(core): harden content library contracts * fix(core): validate video response boundaries * fix(core): distinguish no-content responses * fix(core): scope no-content status handling * fix(core): distinguish empty response bodies * test(core): isolate Content Library smoke coverage * feat(core): keep content library APIs compatible with v3 * fix(core): align content library rollout contracts (YPE-6573) * fix(core): accept empty video filters and trim search bundles (YPE-6573) * fix(core): address content library review feedback (YPE-6573) * docs(core): clarify video APIs and live validation (YPE-6573) * fix(core): use stable Content Library routes (YPE-6573) * feat(core): add Notes API client (#497) * feat(core): add Notes API client Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a * fix(core): address Notes API review feedback Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a * fix(core): normalize Notes write colors * fix(core): address Notes API contract review * fix(core): enforce Notes version filters and tolerate malformed passages * fix(core): isolate malformed Notes list records Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a * chore: refresh combined core bundle budget Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a --------- Co-authored-by: Amp <amp@ampcode.com> * fix(ui): preserve newer selection after native Share (YPE-6812) (#494) * fix(ui): label reader sign-in menu trigger (YPE-6810) (#492) * fix(ui): label reader sign-in menu trigger (YPE-6810) * test(ui): capture Linux WebKit dialog visibility failures * test(ui): stress WebKit visibility diagnostics * test(ui): check settings visibility after keyboard focus Assert dialog opening state after Enter and visibility on the Close button after native Tab, alongside the focus-ring checks. Remove temporary WebKit diagnostics and repeated CI groups. * fix(ui): handle reader clipboard failures (#490) * fix(ui): handle reader clipboard failures (YPE-6809) * fix(ui): report clipboard failures and retry failed shares * fix(ui): keep clipboard warnings visible while scrolling * fix(ui): ignore stale clipboard action results * fix(ui): support Bible reader interactions in iframes (YPE-6410) (#491) * fix(ui): retain iframe verse selection and anchors (YPE-6410) * test(ui): cover iframe highlight painting and reset * fix(ui): complete iframe reader text and focus handling * fix(ui): handle reader host callback exceptions (YPE-6811) (#493) * chore(ui): align declaration build with strict checks (YPE-6464) (#503) chore(ui): align declaration build with strict checks Refs: YPE-6464 * chore: enable additional TypeScript safety checks (#505) * chore(ui): align declaration build with strict checks Refs: YPE-6464 * chore: enable additional TypeScript safety checks Refs: YPE-6832 * feat(ui): customize verse actions and indicators (#506) * feat(ui): customize verse actions and indicators Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * test(ui): wait for verse layout in browser journeys Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * fix(ui): keep configured verse actions reachable Make exiting actions inert and keep the visible verse indicator inside its pointer target. Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * fix(ui): keep verse callbacks scoped to the displayed passage Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * fix(ui): preserve verse action focus and warning visibility Signed-off-by: Austin <abharms@gmail.com> * fix(ui): restore focus after rejected verse action dismissal Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> --------- Signed-off-by: Austin <abharms@gmail.com> * test(ui): wait for host isolation colors to settle Amp-Thread-ID: https://ampcode.com/threads/T-01a22d50-d764-7577-a16d-dcc6f7081eba * fix(core): address Notes and serializer review feedback Amp-Thread-ID: https://ampcode.com/threads/T-01a22d5e-80f8-71c4-80b9-80b0e2702720 * fix(ui): preserve failed verse actions and guard browser stories Keep built-in Copy and Share fallback retryable until copying succeeds, and ignore stale clipboard completions after selection changes. Restrict chapter-picker native keyboard helpers to Vitest browser runs. Amp-Thread-ID: https://ampcode.com/threads/T-01a22d5e-80f8-71c4-80b9-80b0e2702720 * fix(ui): invalidate verse actions on prompt takeover and unmount Amp-Thread-ID: https://ampcode.com/threads/T-01a22d5e-80f8-71c4-80b9-80b0e2702720 --------- Signed-off-by: Austin <abharms@gmail.com> Co-authored-by: platform-localization-pr-bot[bot] <294853593+platform-localization-pr-bot[bot]@users.noreply.github.com> Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Austin <abharms@gmail.com> Co-authored-by: Amp <amp@ampcode.com>
* chore: sync react localization from platform-localization (#478) chore: sync react localization Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com> * fix(core): sanitize planted footnote content in Bible HTML (#486) * fix(core): sanitize planted footnote content in Bible HTML Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com> * fix(core): address review on footnote sanitization Sanitize footnote content in an inert template, drop non-HTML-namespace elements, sanitize generated footnote content for idempotency, document the sanitization contract, and consolidate tests. Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(ui): organize Bible reader modules (#489) * refactor(ui): organize Bible reader modules (YPE-6808) * refactor(ui): extract reader settings lifecycle and toolbar (#495) * refactor(ui): extract reader settings lifecycle and toolbar (YPE-6815) * fix(ui): address reader settings review feedback * feat(ui): re-export passage and versions hooks (#500) * feat(ui): re-export passage and versions hooks Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7 * chore(ci): remove packed UI consumer check * docs(ui): clarify shared provider import guidance Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7 * docs: address hook re-export review nits Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7 --------- Co-authored-by: Amp <amp@ampcode.com> * fix(ui): preserve focus at high zoom (#485) * fix(ui): preserve focus at high zoom * fix(ui): harden zoom focus coverage * refactor(ui): simplify zoom focus handling * test(ui): cover zoom focus behavior * test(ui): focus reader close before asserting * fix(ui): address zoom review findings * test(ui): compare pointer focus styles * test(ui): respect focus-visible heuristics * test(ui): use native focus traversal * fix(ui): scope focus preservation * fix(ui): preserve sign-in focus contrast * test(ui): await close focus transition * refactor(ui): centralize picker scroll geometry * fix(ui): keep picker focus visible in constrained panels * fix(ui): preserve the expanded book trigger in compact panels * test(ui): reach reader settings close with native keys * fix(ui): honor reduced motion in chapter reveal * fix(ui): address focus and scroll review feedback * fix(ui): reveal focused chapters in Firefox Keep focused book triggers fully visible within the built-in accordion on Linux Firefox. Wait for the settings dialog opening animation before asserting visibility in WebKit. * test(ui): query the current settings dialog while opening * feat(core): add Content Library video APIs (YPE-6573) (#488) * feat(core): add content library video APIs * refactor(core): simplify video schema ownership * fix(core): harden content library contracts * fix(core): validate video response boundaries * fix(core): distinguish no-content responses * fix(core): scope no-content status handling * fix(core): distinguish empty response bodies * test(core): isolate Content Library smoke coverage * feat(core): keep content library APIs compatible with v3 * fix(core): align content library rollout contracts (YPE-6573) * fix(core): accept empty video filters and trim search bundles (YPE-6573) * fix(core): address content library review feedback (YPE-6573) * docs(core): clarify video APIs and live validation (YPE-6573) * fix(core): use stable Content Library routes (YPE-6573) * feat(core): add Notes API client (#497) * feat(core): add Notes API client Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a * fix(core): address Notes API review feedback Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a * fix(core): normalize Notes write colors * fix(core): address Notes API contract review * fix(core): enforce Notes version filters and tolerate malformed passages * fix(core): isolate malformed Notes list records Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a * chore: refresh combined core bundle budget Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a --------- Co-authored-by: Amp <amp@ampcode.com> * fix(ui): preserve newer selection after native Share (YPE-6812) (#494) * fix(ui): label reader sign-in menu trigger (YPE-6810) (#492) * fix(ui): label reader sign-in menu trigger (YPE-6810) * test(ui): capture Linux WebKit dialog visibility failures * test(ui): stress WebKit visibility diagnostics * test(ui): check settings visibility after keyboard focus Assert dialog opening state after Enter and visibility on the Close button after native Tab, alongside the focus-ring checks. Remove temporary WebKit diagnostics and repeated CI groups. * fix(ui): handle reader clipboard failures (#490) * fix(ui): handle reader clipboard failures (YPE-6809) * fix(ui): report clipboard failures and retry failed shares * fix(ui): keep clipboard warnings visible while scrolling * fix(ui): ignore stale clipboard action results * fix(ui): support Bible reader interactions in iframes (YPE-6410) (#491) * fix(ui): retain iframe verse selection and anchors (YPE-6410) * test(ui): cover iframe highlight painting and reset * fix(ui): complete iframe reader text and focus handling * fix(ui): handle reader host callback exceptions (YPE-6811) (#493) * chore(ui): align declaration build with strict checks (YPE-6464) (#503) chore(ui): align declaration build with strict checks Refs: YPE-6464 * chore: enable additional TypeScript safety checks (#505) * chore(ui): align declaration build with strict checks Refs: YPE-6464 * chore: enable additional TypeScript safety checks Refs: YPE-6832 * feat(ui): customize verse actions and indicators (#506) * feat(ui): customize verse actions and indicators Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * test(ui): wait for verse layout in browser journeys Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * fix(ui): keep configured verse actions reachable Make exiting actions inert and keep the visible verse indicator inside its pointer target. Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * fix(ui): keep verse callbacks scoped to the displayed passage Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> * fix(ui): preserve verse action focus and warning visibility Signed-off-by: Austin <abharms@gmail.com> * fix(ui): restore focus after rejected verse action dismissal Refs: YPE-6782 Signed-off-by: Austin <abharms@gmail.com> --------- Signed-off-by: Austin <abharms@gmail.com> * feat(ui): add Reader note saving Ref: YPE-6783 * fix: recover Reader Notes after interrupted authorization Preserve the draft on browser Back and clean up a partially persisted automatic token refresh. Keep the composer within narrow viewports and simplify the shared action and highlight paths. Ref: YPE-6783 * fix: preserve Reader Notes through authorization Keep note handoffs bound to their initiating Reader and authorization attempt. Preserve focus, existing verse actions, and a recoverable draft across OAuth failures and navigation. Ref: YPE-6783 * fix: preserve Reader sessions and highlight refresh Keep OAuth recovery bound to the initiating draft and restore focus around the Notes composer. Refresh highlights for the passage on screen and preserve existing host sign-in behavior. Ref: YPE-6783 * fix: preserve Reader draft recovery and auth compatibility Keep host-controlled toolbar scopes, restore legacy startup token rotation, and retain the captured draft through a verified failed callback. Verify the workflow with isolated browser fixtures and native Safari. Ref: YPE-6783 * fix: preserve Reader auth and passage ownership Keep verified legacy auth tokens available, discard drafts for ended sessions, restore selection during host takeover, and gate highlight writes to the rendered passage. Ref: YPE-6783 * fix: preserve Reader drafts and OAuth attempt ownership Retain clean-canceled drafts across navigation, allow matching-chapter highlight intents, and keep verified auth state bound to its active account and handoff. Ref: YPE-6783 * fix: isolate Reader authorization handoffs Resume Notes on the verified configured callback, supersede an older pending highlight action, and keep account-bound requests and drafts tied to the right session. Preserve standalone swatch outlines under host styling. Ref: YPE-6783 * fix: recover Reader note edits after a lost response Retry the original create payload, then reconcile the current draft against the recovered note ID using the verified writer token. Keep that ID and draft after a failed update. Ref: YPE-6783 * fix: retry Notes writes after definite rejections Allow corrected create fields and retain known blank content after a definitive HTTP rejection, while preserving recovery from earlier uncertain writes. Ref: YPE-6783 * fix: retry corrected Notes payloads after a 413 Release an unresolved create payload after a size rejection. Retain the request UUID and preserve recovery when the note ID is already known. Ref: YPE-6783 * fix(ui): preload destination highlights (YPE-6783) * docs: clarify legacy auth recovery (YPE-6783) * test(ui): await destination passage before save refresh (YPE-6783) * test(ui): await settled highlight colors (YPE-6783) * chore: sync react localization * fix(ui): announce note highlight color names * fix(ci): verify imported localization provenance * fix(ui): expose action labels and record Notes QA evidence * chore: remove pilot reports and obsolete localization support Keep QA evidence in Jira, the PR, and BrowserStack. Restore the main localization ownership policy and remove superseded sync changesets now that PR507 is merged. SDK implementation and locale catalogs are unchanged. * fix: harden Reader Notes authorization and integration * fix: refresh OAuth tree-shaking sentinel * refactor: narrow reader notes auth and test scope * test: remove redundant notes browser scenarios * refactor: reuse oauth cleanup and reader scope checks * fix(ui): align notes composer with save design * test(ui): wait for clipboard retry action visibility * fix(ui): accept normalized note save responses Reconcile current draft fields against the original submitted fields rather than the API response. Trust validated successful updates while retaining the resource-ID check. Existing Notes journeys cover trimmed update content and normalized create line endings. * fix(ui): preserve verse action compatibility for notes Keep the published built-in action union and explicit custom action lists unchanged. Save remains in the default actions, so Notes can ship as a minor addition. Preserve both sample demonstrations with a default/custom action toggle. * fix(ui): recover note drafts after validation rejections * chore: sync react localization * fix(ui): name the note visibility selector accessibly * chore(demo): remove preloaded verse marker * fix(ui): toggle note visibility directly * docs(demo): update verse marker smoke instructions * fix(ui): align reader notes actions and authorization * test(ui): wait for custom action popover visibility --------- Signed-off-by: Austin <abharms@gmail.com> Co-authored-by: platform-localization-pr-bot[bot] <294853593+platform-localization-pr-bot[bot]@users.noreply.github.com> Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com> Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: abharms <16394621+abharms@users.noreply.github.com>
YPE-6812
A delayed native Share completion could clear a newer verse selection and, after navigation, emit an empty-selection payload for the previous chapter. Capture the initiating selection's identity and run current cleanup only if that selection is still current. Deselecting and reselecting the same verse also counts as a new selection.
Five reader regression cases cover an unchanged selection, a different selection, reselected same verse, navigation plus a new selection, and navigation without selection. Before the fix, the three changed-selection cases failed while the two controls passed; all five pass with the guard.
Native timing was also verified in Chrome 157 on macOS on a diagnostic page using actual navigator.share and the native Copy action: a page selection click occurred while Share was pending, then the original request resolved. This confirms the timing prerequisite; it was not a complete native-sheet reader E2E run. Safari and mobile were not verified.
Validation: all 627 UI tests passed across 56 files; type checking, focused lint, formatting and diff checks passed. Core/hooks use the unchanged base validated earlier in this session (352 core tests passed, 2 opt-in tests skipped; 200 hooks tests passed). Includes a UI patch changeset.
Independently based on main. Native Share cancellation, host onShare overrides, clipboard fallback, and other reader fixes are outside this diff.


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Native Share now clears only the selection that started it.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Start native Share] --> B[Remember selection array] B --> C[Share completes] C --> D{Same selection array?} D -->|Yes| E[Run current cleanup] D -->|No| F[Leave current selection alone]Reviews (1) · Last reviewed commit: "fix(ui): preserve newer selection after ..." · Reviewed by Greptile