Opened 15 years ago

Closed 14 years ago

#5892 closed Bug (invalid)

Table tab behavior interfering with customized tab behavior

Reported by: Lynne Kues Owned by:
Priority: Normal Milestone: CKEditor 3.4
Component: General Version:
Keywords: IBM Pending Cc:

Description (last modified by Frederico Caldeira Knabben)

FF 3.6 only. The issue does not exist on IE. Version 3.4 Beta.

We are hooking tab to perform indent/outdent. This behavior no longer works in FF with the tab behavior that exists for tables. Perhaps this is not a bug, but an incorrect implementation on our part. Here is the code we are using:

// Use tab to indent and outdent.  Use ctrl-tab, ctrl-shift-tab
// to move focus out of the editor
editor.addCommand('blur', {
    exec : function() {
        editor.container.focusNext(true, editor.tabIndex);
    }
});
editor.addCommand('blurBack', {
    exec : function() {
        editor.container.focusPrevious(true, editor.tabIndex);
    }
});
editor.on("key", function(ev) {
    var keyCode = ev.data.keyCode;
    if (keyCode == 9)	{
        ev.cancel();
        editor.execCommand("indent");
    }
    if (keyCode == (CKEDITOR.SHIFT + 9)) {
        ev.cancel();
        editor.execCommand("outdent");
    }
    if (keyCode == (CKEDITOR.CTRL + 9))	{
        ev.cancel();
        editor.execCommand("blur");
    }
    if (keyCode == (CKEDITOR.CTRL + CKEDITOR.SHIFT + 9)) {
        ev.cancel();
        editor.execCommand("blurBack");
    }
});

Attachments (1)

5892_tc.html (1.0 KB) - added by Frederico Caldeira Knabben 15 years ago.
Test page

Download all attachments as: .zip

Change History (11)

comment:1 Changed 15 years ago by Tobiasz Cudnik

Keywords: Pending added

I've successfully used you code in both IE and FF 3.6. In both cases, tab/shift+tab was performing indentation and no other action. This includes table cells (content in the cell was indented.

Could you explain more precisely what's your expected behavior and what actually happens ?

comment:2 Changed 15 years ago by Tobiasz Cudnik

Keywords: Pending removed

Please ignore my previous comment, i wasn't testing the correct branch. Sorry for any confusion.

comment:3 Changed 15 years ago by Frederico Caldeira Knabben

Description: modified (diff)

comment:4 Changed 15 years ago by Tobiasz Cudnik

Keywords: Pending added

After checking 3.4 branch on FF 3.6 in both windows and linux i can't reproduce this issue. Indentation always works.

Maybe there's some other code on your side which interferes with the editor ?

Changed 15 years ago by Frederico Caldeira Knabben

Attachment: 5892_tc.html added

Test page

comment:5 Changed 15 years ago by Frederico Caldeira Knabben

I've attached a test page to the ticket. It works well for me with both Firefox and IE, when using the 3.4.x branch. TAB and SHIFT+TAB indent/outdent the text, as expected.

Can you add more information, so we're able to reproduce the problem here?

comment:6 Changed 15 years ago by Lynne Kues

Your code snippet works for me too. The behavior I am seeing is that with the 3.4 Beta zip code, the tab keystroke is not coming into the keyevent handler (on FF), so our code is being bypassed and the default tab behavior is being invoked. Our code is in a plugin, which is different than the code snippet.

comment:7 Changed 14 years ago by Tobiasz Cudnik

There's possible scenario that some other of your plugins is attached to the TAB key event and then cancels the event, preventing it from calling rest of the listeners.

comment:8 Changed 14 years ago by Frederico Caldeira Knabben

I think it's just a matter of priority, and the order the "key" event listeners are being registered.

To solve this, you should simply set the priority parameter when calling the on() function.

Please let us know if that fixed the issue, so we can invalidate this ticket.

comment:9 Changed 14 years ago by Lynne Kues

Yes, this is a matter of priority. You can close this ticket. Thanks.

comment:10 Changed 14 years ago by Frederico Caldeira Knabben

Description: modified (diff)
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy