Document in design mode loses focus when arrow keys, home, page down, page up and tab are pressed

UNCONFIRMED
Unassigned

Status

()

Core
Editor
UNCONFIRMED
5 years ago
3 years ago

People

(Reporter: Jakub Ondrusek, Unassigned)

Tracking

13 Branch
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

1.00 KB, application/vnd.mozilla.xul+xml
Details
(Reporter)

Description

5 years ago
Created attachment 645011 [details]
testcase.xul

User Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0
Build ID: 20120607133124

Steps to reproduce:

I designed a XUL window with an HTML editor embedded in an iframe. (see attachment)


Actual results:

Arrow keys, home, end, page up, page down and tab cause the editor lose focus. They do not perform the desired action. Instead, focus jumps to the next sibling element of the iframe. In case of the example, to the textbox.


Expected results:

The keys should have worked as expected.
(Reporter)

Updated

5 years ago
Component: Untriaged → Editor
Product: Firefox → Core

Comment 1

5 years ago
Is this a regression?

Updated

5 years ago
Attachment #645011 - Attachment mime type: application/octet-stream → application/vnd.mozilla.xul+xml
(Reporter)

Comment 2

5 years ago
I should note I am using this in a firefox addon and it's no longer supported as remote content.

Comment 3

4 years ago
I've run into this problem myself, and I found that if I replace my <iframe> with <editor> then the cursor keys will work.

Comment 4

4 years ago
After further testing I found that you need to have type="content-primary", so it should something like <editor id="my-editor" type="content-primary" editortype="html" />

But using type="content-primary" creates some other problems.  For example <editor flex="1"> does nto work if the <editor> is enclosed inside a <vbox>.  Another problem is that overflow: auto no longer works.

Comment 5

3 years ago
The solution is actually quite simple.  If I use <iframe type="content"> then there is no problem with the cursor keys.  I changed testcase.xul with the line <iframe id="theframe" src="http://www.google.com" type="content" flex="10"/> and the problem went away.  Note that in order to see the problem the file testcase.xul has to be launched into its own window using window.openDialog("testcase.xul", "_blank", "centerscreen,resizable=yes,dialog=no"), there is no cursor key problem if testcase.xul is opened in a browser tab.

Comment 6

3 years ago
The problem with type="content" solution is this iframe is not running in the chrome security context and many editing interactions are forbidden.

Note : this issue is a regression after XulRunner10.

A possible hack for this issue is to handle yourself all these events and directly call navigation methods on Editor.selectionController.

An other horrible hack in XulRunner is to by-pass Controller/Command framework in chrome/toolkit/content/global/platformHTMLBindings.xml

For example replace in the <binding id="editor"> :
<handler event="keypress" keycode="VK_LEFT" modifiers="accel" command="cmd_moveLeft2"/>
by :
<handler event="keypress" keycode="VK_LEFT" modifiers="accel">event.target.ownerGlobal.realFrameElement.getEditor(event.target.ownerGlobal).selectionController.wordMove(false, false);</handler>
You need to log in before you can comment on or make changes to this bug.