This is a migrated thread and some comments may be shown as answers.

tab focus in editor

6 Answers 711 Views
Editor
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 04 Jun 2013, 06:57 PM
When tabbing to the editor from another input field, the focus first goes to the buttons (bold, italic, etc) instead of giving focus to the actual editable area.

Is there a workaround to this?

6 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 06 Jun 2013, 11:40 AM
Hello John,

You could set the tabindex attribute to -1 for the buttons so that they are excluded from the tabbing order.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 1
answered on 06 Jun 2013, 09:06 PM
$(function () {
     $('li.k-editor-button').attr('tabindex', -1);
});

setting the tabindex for the class k-editor-button does not exclude it from the tab order even though I see the attribute has been added in html to the editor. Is there something overriding the tab index?
0
Accepted
Daniel
Telerik team
answered on 10 Jun 2013, 12:02 PM
Hello John,

The li elements will not get focused by default. You should set the tabindex to the anchors, spans and inputs. Check this jsBin example.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 1
answered on 10 Jun 2013, 07:57 PM
this worked like a charm. thanks :)
0
Uwe
Top achievements
Rank 1
answered on 12 Dec 2017, 07:33 AM

Using the "MVC version", the above JS Bin example did not work for me. My solution:

@* HTML editor. *@
@(Html.Kendo().EditorFor(m => m.AdditionalRemarks)
                .HtmlAttributes(new { style = @"width: 100%; height:350px" })
                .Encode(false)
                .Resizable(resizable =>
                    resizable.Content(true)
                        .Toolbar(true))
                .Tools(tools =>
                    tools.Clear()
                        .Bold()
                        .Italic()
                        .InsertOrderedList()
                        .InsertUnorderedList()
                        .Outdent()
                        .Indent()
                        .CreateLink()))
 
<script>
    @* Disable tabbing through editor toolbar buttons. *@
    function adjustToolBarButtons() {
        $('.k-editor-toolbar').each(function () {
            $(this).find('*').attr("tabindex", -1);
        });
    }
 
    @* Place this after the editor definition. *@
    $(function () {
        adjustToolBarButtons();
    });
</script>
0
Ivan Danchev
Telerik team
answered on 13 Dec 2017, 11:33 AM
Hello,

Setting the tabindex attribute of the elements in the Editor's toolbar on document.ready, as Uwe demonstrated, is the correct approach when using the Editor's MVC wrapper.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Editor
Asked by
John
Top achievements
Rank 1
Answers by
Daniel
Telerik team
John
Top achievements
Rank 1
Uwe
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or