Repository navigation
fix(editor): preserve first-click caret in WKWebView - #737
Merged
Merged
Conversation
Apply CodeMirror's existing Safari scroll-restoration fallback when WKWebView omits the browser version. Cover both module entry points with focus regression tests. Fixes #736
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Opening a long note and clicking below the fold for the first time can scroll macOS WKWebView back to the top and create a large selection. WKWebView omits the
Version/user-agent token, so CodeMirror detects Safari version 0 and skips its Safari 26+ workaround for brokenfocus({ preventScroll: true })support. The scroll reset changes the document position between the two hit tests for the same click.Apply a pnpm patch to
@codemirror/view@6.41.1that includes unknown Safari versions in the existing scroll-restoration fallback. Both ESM and CommonJS entry points are patched, and the same dependency serves the visual and source editors. Add regression coverage for initial focus and refocus, including nested vertical and horizontal scroll positions, and document when to remove the patch.Closes #736.
Validation
0instead of1600, then passed for both module entry points.corepack pnpm --filter @markra/editor test— 596 tests passed.corepack pnpm --filter @markra/app test src/components/CodeMirrorPaperSurface.test.tsx src/components/MarkdownSourceEditor.test.tsx src/hooks/useCodeMirrorEditorController.test.tsx— 67 tests passed.corepack pnpm --filter @markra/editor-react test— 6 tests passed.corepack pnpm --filter @markra/editor typecheck:test— passed.corepack pnpm install --frozen-lockfile --ignore-scripts— passed.corepack pnpm build— passed, including web and desktop frontend builds and vendor-chunk validation.Browser QA used the actual editor components after fonts and layout settled. The system WKWebView UA was independently confirmed with a native WebKit probe; the packaged Tauri app was not exercised.