Skip to content

Fixed selection attributes handling after softBreak.#19918

Open
arkflpc wants to merge 2 commits intomasterfrom
ck/19853-softBreakAndSelection
Open

Fixed selection attributes handling after softBreak.#19918
arkflpc wants to merge 2 commits intomasterfrom
ck/19853-softBreakAndSelection

Conversation

@arkflpc
Copy link
Contributor

@arkflpc arkflpc commented Mar 6, 2026

🚀 Summary

Improved document selection attribute inheritance around <softBreak> so returning the caret after a soft break restores expected formatting.

When selection attributes are recalculated across <softBreak>, only attributes marked with copyOnEnter are inherited. Other inline non-object elements still act as hard boundaries.


📌 Related issues


💡 Additional information

Optional: Notes on decisions, edge cases, or anything helpful for reviewers.


🧾 Checklists

Use the following checklists to ensure important areas were not overlooked.
This does not apply to feature-branch merges.
If an item is not relevant to this type of change, simply leave it unchecked.

Author checklist

  • Is the changelog entry intentionally omitted?
  • Is the change backward-compatible?
  • Have you considered the impact on different editor setups and core interactions? (e.g., classic/inline/multi-root/many editors, typing, selection, paste, tables, lists, images, collaboration, pagination)
  • Has the change been manually verified in the relevant setups?
  • Does this change affect any of the above?
  • Is performance impacted?
  • Is accessibility affected?
  • Have tests been added that fail without this change (against regression)?
  • Have the API documentation, guides, feature digest, and related feature sections been updated where needed?
  • Have metadata files (ckeditor5-metadata.json) been updated if needed?
  • Are there any changes the team should be informed about (e.g. architectural, difficult to revert in future versions or having impact on other features)?
  • Were these changes documented (in Logbook)?

Reviewer checklist

  • PR description explains the changes and the chosen approach (especially when performance, API, or UX is affected).
  • The changelog entry is clear, user‑ or integrator-facing, and it describes any breaking changes.
  • All new external dependencies have been approved and mentioned in LICENSE.md (if any).
  • All human-readable, translateable strings in this PR been introduced using t() (if any).
  • I manually verified the change (e.g., in manual tests or documentation).
  • The target branch is correct.

@arkflpc arkflpc requested review from Mati365 and niegowski March 6, 2026 11:25
Copy link
Member

@Mati365 Mati365 left a comment

Choose a reason for hiding this comment

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

Looks ok. I left one comment. Make sure manual QA testing is performed, and E2E testing was executed on this PR.

@Mati365
Copy link
Member

Mati365 commented Mar 9, 2026

@arkflpc Please merge recent master, or cherry-pick 1d846d2 in order to fix failing manual tests.

Comment on lines +1260 to +1264
for ( let node: ModelNode | null = startNode; node; node = getNextNode( node ) ) {
if ( node.is( 'element', 'softBreak' ) ) {
crossedSoftBreak = true;
continue;
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure whether the engine should be aware of the existence of the softBreak element. It's registered in an external plugin. Would a schema flag be better? What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

We discussed with @niegowski, and it might be good idea to store some info in schema / attribute properties. However, there might be another workaround related to storing attributes on soft-breaks itself. We need to discuss it a little bit more.

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.

Double Shift+Enter should preserve selection attributes.

2 participants