Skip to content

[lexical] Bug Fix: account for Apple WebView in setManagedLineBreak#7854

Merged
etrepum merged 3 commits intofacebook:mainfrom
elpnt:webkit-hack
Sep 25, 2025
Merged

[lexical] Bug Fix: account for Apple WebView in setManagedLineBreak#7854
etrepum merged 3 commits intofacebook:mainfrom
elpnt:webkit-hack

Conversation

@elpnt
Copy link
Copy Markdown
Contributor

@elpnt elpnt commented Sep 24, 2025

Description

Currently, setManagedLineBreak only accounts for IS_IOS and IS_SAFARI when applying the WebKit-specific hack for line breaks.
However, in Apple’s WebView environments (such as Tauri with wry on macOS), IS_APPLE_WEBKIT is true but not considered, which can lead to inconsistent line break rendering and cursor behavior.

This PR updates the logic so that the WebKit-specific hack also applies when IS_APPLE_WEBKIT is true. This ensures consistent behavior across iOS Safari, standalone Safari, and embedded Apple WebView environments.

Before

before.mp4
  • On Apple WebView (Tauri on macOS), line breaks inserted by decorator nodes were not managed correctly.
  • Cursor movement and rendering could become inconsistent.

After

after.mp4
  • In Apple WebView, the decorator line break type is now handled the same way as in Safari.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 24, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Sep 24, 2025

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

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Sep 24, 2025 4:11pm
lexical-playground Ready Ready Preview Comment Sep 24, 2025 4:11pm

ivailop7
ivailop7 previously approved these changes Sep 24, 2025
@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Sep 24, 2025
Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

Interesting, it looks like the jsdom implementation might look enough like webkit for this change to break the unit test expectations? I think it's fine if the expectation changes, but the tests should pass before we merge

@etrepum
Copy link
Copy Markdown
Collaborator

etrepum commented Sep 24, 2025

I think this is probably good, but there is some chance that our e2e tests on mac+chromium are not catching some regression where we expect Chrome to also be IS_APPLE_WEBKIT on macOS. We might want to note that as a breaking change. Here's an example Chrome userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36'

@elpnt
Copy link
Copy Markdown
Contributor Author

elpnt commented Sep 25, 2025

Are there any cases where Chrome on macOS is expected to be IS_APPLE_WEBKIT?
I think this isn’t a breaking change, since the previous IS_APPLE_WEBKIT already accounted for !IS_CHROME.

Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

It looks like you're right, I just missed that at first glance because it's on another line. I think this should be good to go then

@etrepum etrepum added this pull request to the merge queue Sep 25, 2025
Merged via the queue into facebook:main with commit a278e96 Sep 25, 2025
42 checks passed
@etrepum etrepum mentioned this pull request Sep 25, 2025
@etrepum etrepum mentioned this pull request Sep 25, 2025
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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants