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

[Solved] Is it possible to change the TAB character behavior?

1 Answer 172 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mark Davis
Top achievements
Rank 1
Mark Davis asked on 07 Dec 2007, 12:08 AM
I would like to change the current tab behavior. Currently, pressing tab in the content places a TAB character into the content, whereas I would like to move focus to the next control in the tab order (a "Save" button in my scenario).

Also, when a user tabs into the editor from the previous control in the tab order, focus is set to the first button on the toolbar, whereas I would like to set focus in the content area.

Is there an easy way to change this behavior, or do I need to add my own event handler?

1 Answer, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 10 Dec 2007, 03:17 PM
Hello Mark,

At present there is a built-in editor shortcut F10 that will move the focus from the editor to the toolbar and back.

In IE, pressing the TAB into the content area causes it to lose focus and move to the next element. This is not the behavior the huge majority of users require. It is counterintuitive and in fact, in FireFox and other supported browsers, pressing the TAB key inserts several whitespaces.

So, in IE the editor implements its own version of the TAB command called InsertTab, which you can easily detect in
the OnClientCommandExecuting event and write code that will move the focus to another element (and cancel the original command by setting args.set_cancel(true).
You can find information on how to do it in this online demo:
http://www.telerik.com/DEMOS/ASPNET/Prometheus-Futures/Editor/Examples/ClientsideEvents/DefaultCS.aspx


However, if you need to achieve the same behavior in non-IE browsers, you will need to attach to onkeydown in  the editor content area using attachEventHandler function.


Sincerely yours,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
Mark Davis
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Share this question
or