Selection is sometimes not merged correctly #10628
Labels
browser:firefox
package:engine
squad:core
Issue to be handled by the Core team.
squad:features
Issue to be handled by the Features team.
type:bug
This issue reports a buggy (incorrect) behavior.
Milestone
📝 Provide detailed reproduction steps (if any)
Similar case originally reported in https://github.com/cksource/ckeditor5-internal/pull/1006#issuecomment-931116656.
The
mergeIntersectingRanges()
function inpackages/ckeditor5-engine/src/model/utils/selection-post-fixer.js
does not work as expected in some cases using Firefox.Let's assume the following:
We have 3 ranges to merge in the following order:
A
,B
andC
.The
A
range is not intersecting with theB
range.The
C
range is intersecting withA
andB
.The
mergeIntersectingRanges()
function returns incorrectly 2 ranges:A
andB + C
, because it checks only the previous range and not all previously handled ranges, as it should.✔️ Expected result
The expected result is one merged range
A + B + C
.❌ Actual result
Currently, this function returns 2 ranges:
A
andB + C
, but theA
range is intersecting withB + C
(becauseC
is intersecting withA
as I described in the preconditions).❓ Possible solution
This function should check all already handled ranges and not only the previous one.
📃 Other details
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: