fix(ios): typing attributes clearing on keystrokes - #773
Open
hejsztynx wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an iOS TextKit edge case where typingAttributes can be cleared between a selection change (especially via tap) and the next keystroke, causing newly typed text to lose formatting. The fix preserves typing attributes by re-running typing-attributes management immediately before character insertion.
Changes:
- Track the last
onlySelectionChangedvalue used during typing-attributes management and expose a method to re-run it. - Re-run recent typing-attributes management in
textView:shouldChangeTextInRange:right before insertion to prevent cleared attributes. - Minor comment updates related to the new behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ios/inputAttributesManager/InputAttributesManager.mm | Stores the most recent onlySelectionChanged flag and adds a method to re-run typing-attribute management. |
| ios/inputAttributesManager/InputAttributesManager.h | Exposes repeatRecentTypingAttributesManagement for callers. |
| ios/EnrichedTextInputView.mm | Calls the repeat method before text insertion to prevent typing attributes from being cleared. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
hejsztynx
marked this pull request as ready for review
August 14, 2026 11:22
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.
Summary
There was a bug when in some cases, between selection change and a keystroke, the typing attributes would get cleared, resulting in unstyled text. More info in the
Screenshots / Videossection.All iOS e2e tests pass.
Test Plan
Reproduce the flow from the attached videos, it should be fine now.
Screenshots / Videos
Before:
When changing the selection programmatically, via arrow keys, the typing attributes are correctly preserved
Screen.Recording.2026-08-14.at.11.22.08.mov
When using screen taps though, the typing attributes are not preserved resulting in the unstyled text, even though (in this case bold) was marked as active
Screen.Recording.2026-08-14.at.11.23.10.mov
After:
Typing attributes are correctly preserved whatever the selection change method
Screen.Recording.2026-08-14.at.11.09.03.mov
Compatibility
Checklist