Opened 14 years ago

Last modified 13 years ago

#6015 confirmed Bug

(Webkit) Can't tab forward from CKEditor followed by <fieldset> or <legend>

Reported by: Richard Barrell Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: Webkit Cc:

Description

In Webkit, element.tabIndex usually returns -1 for elements that can't be focused on, and 0 for elements that can. However, Webkit also (incorrectly) returns 0 for the tabIndex of <fieldset> and <legend> elements, despite the fact that calling .focus() on a <fieldset> or a <legend> has no effect.

The fallout of this from CKEditor's perspective is that if you have the following structure:

<form>

<textarea class="ckeditor" name="wysiwyg"> </textarea> <!-- possibly other content, all of which has tabIndex of -1 --> <fieldset>

<input type="text" name="other_input" />

</fieldset>

</form>

then when you try to use the tab key to navigate from the wysiwyg element to the other_input element, you'll appear to get "stuck" inside the wysiwyg element. What happens is that the tab plugin sees that the <fieldset> appears to have a tabindex of 0, and hence calls the fieldset's .focus() method instead of the other_input's .focus() method.

I've confirmed this both in 3.3.1 and trunk. Attached is a page (intended to be put in the _samples/ directory) upon which this bug can be seen.

My first suggestion is to patch core/dom/element.js to specifically check the tabIndex attribute (which doesn't appear to be bugged) for <fieldset> and <legend> elements. I guess that's a bit of a hack, since someone -could- wish to assign element.tabIndex directly from JavaScript - but I've no idea how to handle that cleanly.

Any better ideas? Patch attached just in case that really is the best way.

I've worked around this in my own code by monkey patching getTabIndex from core/dom/element.js to just always return -1 for <fieldset> and <legend> elements. Not pretty, but fine for the site that I'm working on at the moment.

Naturally I've reported this to Webkit. See https://bugs.webkit.org/show_bug.cgi?id=42765

Attachments (2)

tabindex_bug.html (2.1 KB) - added by Richard Barrell 14 years ago.
HTML page showing tabindex problem. Put it in _samples directory.
tabindex_bug.patch (1.1 KB) - added by Richard Barrell 14 years ago.
Proposed patch. Same workaround as for the fact that old Safari returns "undefined" when it should return -1.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by Richard Barrell

Attachment: tabindex_bug.html added

HTML page showing tabindex problem. Put it in _samples directory.

Changed 14 years ago by Richard Barrell

Attachment: tabindex_bug.patch added

Proposed patch. Same workaround as for the fact that old Safari returns "undefined" when it should return -1.

comment:1 Changed 14 years ago by Richard Barrell

Oh, ick. Apologies if I've screwed up the HTML formatting.

comment:2 Changed 13 years ago by Jakub Ś

Keywords: Webkit added
Status: newconfirmed
Version: SVN (CKEditor) - OLD3.0

Seems to be still reproducible in latest CKEditor 3.6.2 on Webkit.

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