Skip to content

fix(ios): don't clear typing attributes on empty editor focus - #791

Merged
hejsztynx merged 1 commit into
mainfrom
@ksienkiewicz/fix-ios-typing-attributes-on-empty-editor-focus
Sep 8, 2026
Merged

fix(ios): don't clear typing attributes on empty editor focus#791
hejsztynx merged 1 commit into
mainfrom
@ksienkiewicz/fix-ios-typing-attributes-on-empty-editor-focus

Conversation

@hejsztynx

@hejsztynx hejsztynx commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

fixes #322

Currently, in manageTypingAttributesWithOnlySelection:YES, we clear typing attributes and then apply the ones applicable to the content. We also do that when editor's content itself is empty, but when there is no content, there is no need to reapply the typing attributes, as there is nothing to reapply on. That also introduced a case where a user would first set the active styles (typing attributes) programmatically, e.g. via a toolbar, and then focus it. This would result in priorly chosen styles to be reset, which is unintuitive and inconsistent to how it works on both Android and Web.

Test Plan

Follow the steps in the attached video

Screenshots / Videos

Before:

Screen.Recording.2026-09-08.at.15.51.41.mov

After:

Screen.Recording.2026-09-08.at.15.43.45.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 September 8, 2026 13:45
@hejsztynx
hejsztynx marked this pull request as draft September 8, 2026 13:45

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.

🟢 Approval recommended

The change is small, localized, and directly addresses the described iOS behavior without altering the broader typing-attributes flow for non-empty content.

Pull request overview

This PR adjusts iOS typing-attributes management so that focusing an empty editor (where only the selection changed) no longer clears/reset typing attributes, preserving styles set programmatically (e.g., via a toolbar) and aligning behavior with Android/Web.

Changes:

  • Add an early return in manageTypingAttributesWithOnlySelection:YES when the editor content length is 0, avoiding unnecessary typing-attribute clearing/reapplication on an empty document.
File summaries
File Description
ios/inputAttributesManager/InputAttributesManager.mm Skips typing-attribute clearing when only the selection changes and the editor is empty, preventing unintended style resets on focus.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@hejsztynx
hejsztynx requested a review from szydlovsky September 8, 2026 13:48
@hejsztynx
hejsztynx marked this pull request as ready for review September 8, 2026 14:20
@hejsztynx
hejsztynx merged commit 456890f into main Sep 8, 2026
9 checks passed
@hejsztynx
hejsztynx deleted the @ksienkiewicz/fix-ios-typing-attributes-on-empty-editor-focus branch September 8, 2026 21: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.

Styling Modifers Get Removed On Focus

3 participants