test(ios): pin #4394 root cause to stale offsetRef onMouseUp#5
Merged
ethan-james merged 1 commit intoJul 8, 2026
Merged
Conversation
Re-model the isolated caret-focus diagnostics around the confirmed root cause: pre-cybersemics#4371 useEditMode never resets offsetRef.current, so the retargeted mouseup runs onMouseUp -> setCaretOffset -> selection.set and focuses the editable despite onMouseDown preventDefaulting the native focus. The reproduce spec adds a stale-offset mouseup selection (models pre-cybersemics#4371) and shows focus/keyboard proceed; the control spec omits it (models post-cybersemics#4371) and shows focus stays blocked. Make caretFocus.ts version-aware and add a dedicated iOS 17 BrowserStack capability so the same edge tap positively asserts the keyboard opens on iOS 18 but stays down on iOS 17, verifying the bug is iOS-18-specific. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
d928e2c
into
ethan-james-fix-caret-focus-wdio-test
8 of 10 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cybersemics#4394
Root cause (confirmed)
This branch predates PR cybersemics#4371 (
pressingRefabsent; cybersemics#4371 is not an ancestor of HEAD). In the pre-cybersemics#4371useEditMode.ts:offsetRef.currentis assigned when a cursor thought is tapped (line 178) but is never reset tonull.onMouseDown->else->e.preventDefault()blocks native focus.mouseup->onMouseUpreads the staleoffsetRef.current->setCaretOffset->selection.set()-> programmatic focus -> keyboard opens.PR cybersemics#4371 deleted
onMouseUp/offsetRefand movedsetCaretOffsetinto a guardedonMouseDown, removing the vector. cybersemics#4407 sits on post-cybersemics#4371mainand only adds test files, so it passes;caretFocus.tsis byte-identical between the two branches.Why the prior isolated H2 spec was wrong
caretFocusIsolated.ts's fixture editable had onlymousedown(preventDefault) + a focus probe and nomouseup/selection, so it accidentally modeled the fixed (post-cybersemics#4371) code and correctly showedfocused:false. The H2 assertion (focused:true) therefore failed, and the conclusion "iOS ignores mousedown preventDefault" only holds for the no-mouseup configuration — it missed the one variable that distinguishes buggy from fixed: the stale-offsetonMouseUpselection.Changes
caretFocusIsolated.ts— re-modeled to the confirmed mechanism.reproducespec:mousedownpreventDefaults and amouseuprunsselection.setwith a stale, never-reset offset -> focus + keyboard proceed (isolates [iOS] Keyboard incorrectly opens when tapping right edge of thought cybersemics/em#4394 with zero em code).controlspec: nomouseupselection (post-Move setCaretOffset into onMouseDown and preventAutoscrollEnd back into onFocus cybersemics/em#4371) -> focus stays blocked.caretFocus.ts— version-aware. Positively asserts the edge tap opens the keyboard on iOS 18 (repro on this pre-Move setCaretOffset into onMouseDown and preventAutoscrollEnd back into onFocus cybersemics/em#4371 branch) and stays down on iOS 17.wdio.browserstack.conf.ts— adds a dedicated iOS 17 capability runningcaretFocus.ts, so CI verifies the bug is iOS-18-specific.Draft: pending BrowserStack CI to confirm the reproduce/control specs and the iOS 17-vs-18 assertions.