Repository navigation
[lexical] Bug Fix: Detect iPadOS desktop-class user agents - #8909
Merged
Merged
Conversation
iPadOS may expose a Macintosh user agent, causing IS_IOS to evaluate to false. Detect these environments using multi-touch support while keeping macOS and non-Apple touch devices classified as non-iOS. Add unit coverage for classic iOS user agents, iPadOS desktop-class user agents, multi-touch boundaries, and false-positive cases.
Improve iPadOS environment tests. - Reuse the same Macintosh user agent fixture for iPadOS and macOS scenarios to isolate maxTouchPoints as the distinguishing signal. - Restore navigator properties after each test to avoid leaking mocked accessors across test cases.
corinthionia
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
August 3, 2026 15:02
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Aug 5, 2026
Merged
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.
Description
IS_IOScurrently only matches whennavigator.userAgentcontainsiPad,iPhone, oriPod.On the physical iPad tested, both Safari and a React Native app using
react-native-webviewwithout a custom user agent reported a desktop-classMacintoshuser agent withnavigator.maxTouchPointsof5, while a real Mac reported0.As a result,
IS_IOSevaluates tofalsewhen iPadOS presents a desktop-classMacintoshuser agent, preventing existing iOS-specific input handling from running.This change identifies a
Macintoshuser agent withnavigator.maxTouchPoints > 1as iPadOS.Side-effect review
Every current internal use of
IS_IOSin this repository was reviewed.The remaining internal uses continue to behave as before because they are already gated by
IS_SAFARIorIS_APPLE_WEBKIT.Behavior changes in the following areas:
lexical-plain-textlexical-rich-textLexicalEvents.tshandling of non-collapsedtargetRangevalues duringdeleteContentBackwardLexicalEvents.tshandling ofinsertParagraphwheninputState.isInsertLineBreakis setLexicalEvents.tscompositionendtimingThe
compositionendpath was verified manually on a physical iPad using the Japanese Romaji IME, which emits composition events.Test plan
Before
On a physical iPad:
navigator.userAgentcontainedMacintoshnavigator.maxTouchPointswas5IS_IOSevaluated tofalsetargetRangeprovided bybeforeinputwas ignored becauseIS_IOSevaluated tofalse, causing Lexical to fall through toDELETE_CHARACTER_COMMAND.가나다, pressing Backspace deleted the entire final syllable, typingㄹproduced가달, and completing the syllable resulted in가다라instead of the expected가나라.After
Automated verification:
environment.test.tscoverage for:Macintoshuser agent with multi-touchmaxTouchPointsboundary (1vs2)0)Manual verification on a physical iPad using Safari on iPadOS 26.5.2:
가나다→ Backspace →가낟가나다→ Backspace →가낟beforeinputevents were observed; no composition events were emittedcompositionstart,compositionupdate, andcompositionendnihon→日本→ Backspace → re-enterhon