Skip to content

fix(ios): typing attributes clearing on keystrokes - #773

Open
hejsztynx wants to merge 4 commits into
mainfrom
@ksienkiewicz/fix-ios-typing-attributes-desync
Open

fix(ios): typing attributes clearing on keystrokes#773
hejsztynx wants to merge 4 commits into
mainfrom
@ksienkiewicz/fix-ios-typing-attributes-desync

Conversation

@hejsztynx

@hejsztynx hejsztynx commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

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 / Videos section.

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

OS Implemented
iOS
Android
Web

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Copilot AI lite review requested due to automatic review settings August 14, 2026 09:24
@hejsztynx
hejsztynx marked this pull request as draft August 14, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 onlySelectionChanged value 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.

Comment thread ios/EnrichedTextInputView.mm Outdated
Comment thread ios/EnrichedTextInputView.mm Outdated
hejsztynx and others added 2 commits August 14, 2026 11:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@hejsztynx
hejsztynx marked this pull request as ready for review August 14, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants