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)
Change History (4)
Changed 14 years ago by
Attachment: | tabindex_bug.html added |
---|
Changed 14 years ago by
Attachment: | tabindex_bug.patch added |
---|
Proposed patch. Same workaround as for the fact that old Safari returns "undefined" when it should return -1.
comment:2 Changed 13 years ago by
Keywords: | Webkit added |
---|---|
Status: | new → confirmed |
Version: | SVN (CKEditor) - OLD → 3.0 |
Seems to be still reproducible in latest CKEditor 3.6.2 on Webkit.
HTML page showing tabindex problem. Put it in _samples directory.