Keyboard movement incorrect when collapsed selection is between nodes




11 years ago
11 years ago


(Reporter: tr, Unassigned)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



11 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X; ja-JP-mac; rv: Gecko/20080201 Firefox/
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; ja-JP-mac; rv: Gecko/20080201 Firefox/

When a page has designMode enabled, and a cursor is displayed, the cursor moves to the wrong location when the RIGHT (39) key is pressed.

Reproducible: Always

Steps to Reproduce:
1. Create an HTML file with the following source:

		<title>firefox bug?</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<script type="text/javascript">
			window.onload = function(e) {
				document.designMode = "On";
				var sel = window.getSelection();
				var div = document.getElementsByTagName("div")[1];
				sel.collapse(div, 2);
		<div>This is a test.</div>
		<div>First, make sure that the <span>cursor</span> is at the end of the word <code>cursor</code>.</div>
		<div>Now, press the right arrow key to see where the <span>cursor</span> moves.</div>
		<div>In Safari, it moves to the next caret position.</div>
		<div>In FF, it moves to the second letter of the word <span>cursor</span>.</div>
		<div>Is this a bug?</div>

2. Record the position of the cursor.
3. Press the RIGHT key (which = 39).
Actual Results:  
The cursor moves to the position between the first and second characters of the word "cursor".

Expected Results:  
The cursor should move to the position between the next space character and the letter "i".

Says ss in the #firefox channel: (fwiw, I see it in Firefox 3 beta 3 as well)

Comment 1

11 years ago
Created attachment 306229 [details]
A file that illustrates the selection issue.


11 years ago
Component: Keyboard Navigation → Selection
Product: Firefox → Core


11 years ago
QA Contact: keyboard.navigation → selection
I don't see any obvious dupes. Confirming. This happens using Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b5pre) Gecko/2008031015 Minefield/3.0b5pre as well.

Possibly related to bug 377297?
Severity: normal → minor
Ever confirmed: true
Keywords: testcase
This is yet another case where nsFrameSelection::GetFrameForNodeOffset() sucks.

See the last paragraph of bug 322547 comment 6, and bug 363198 comment 30 (unfortunately I lost the work I mentioned there, and I don't even remember exactly what my plan was).
You need to log in before you can comment on or make changes to this bug.