Ticket #4970 (closed Bug: duplicate)

Opened 5 years ago

Last modified 5 years ago

IE selection produces incorrect range when clicking to the right of a <br />

Reported by: Scott Owned by:
Priority: High Milestone:
Component: General Version: SVN (CKEditor) - OLD
Keywords: Cc:

Description

Hello,

The following HTML, with a collapsed selection currently located at "][", will produce an incorrect range in IE. I am quite confident the problem lies in selection/getBoundaryInformation().

HTML: <p>Line 1][<br /> Line 2</p>

The range produced will show the position at: <p>Line 1<br /> ][Line 2</p>

A simple test case would be to call Range::insertNode() with a simple text node with the caret at the above position.

var pNode = new CKEDITOR.dom.node(pRange.document.$.createTextNode('a')); pRange.insertNode(pNode);

I have screencasted this issue to fredck.

Attachments

click_before.png (14.3 KB) - added by Scott 5 years ago.
Click when mouse cursor is text caret
click_after.png (12.0 KB) - added by Scott 5 years ago.
mouse_down_up.png (22.9 KB) - added by Scott 5 years ago.

Change History

Changed 5 years ago by Scott

Click when mouse cursor is text caret

Changed 5 years ago by Scott

Changed 5 years ago by Scott

comment:1 Changed 5 years ago by Scott

  • Priority changed from Normal to High

Ok I spent an hour or so trying to figure out what was going on here, and I have found the location where its going wrong, but I dont know exactly why.

The problem is in selection/plugin.js getBoundaryInformation() at line 471. I am using Companion.JS to enable "console.log".

Here are the console.log calls I made.

var comparison = testRange.compareEndPoints( 'StartToStart', range );
console.log(child.nodeName);
console.log(comparison);

Immediately it showed me why I was experiencing this randomly. The problem only happens when clicking to the right of the <p>, when the mouse cursor icon is "default arrow", not "text".

When you click just at the end of the text, when the caret is text, it works fine. http://dev.fckeditor.net/raw-attachment/ticket/4970/click_before.png

When you click to the right, epic fail. http://dev.fckeditor.net/raw-attachment/ticket/4970/click_after.png

But strangely, something must fix it with an onmouseup handler? It somehow fixes it again if you click and hold down the mouse button for a second or so. On mouse up, the comparison goes back to 0. http://dev.fckeditor.net/raw-attachment/ticket/4970/mouse_down_up.png

Because ranges are so core, this bug could be causing some seemingly random problems for people. Hope it can be fixed soon :)

comment:2 Changed 5 years ago by Scott

  • Summary changed from IE selection produces incorrect range when caret is immediately before a <br /> to IE selection produces incorrect range when clicked to the right of a <br />

comment:3 Changed 5 years ago by Scott

  • Summary changed from IE selection produces incorrect range when clicked to the right of a <br /> to IE selection produces incorrect range when clicking to the right of a <br />

comment:4 Changed 5 years ago by Scott

  • Status changed from new to closed
  • Resolution set to duplicate
Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy