Setting focus on client

2 posts, 1 answers
  1. Andreas
    Andreas avatar
    137 posts
    Member since:
    May 2008

    Posted 14 Oct 2014 Link to this post


    We have a small issue when focus is set on a RadNumericTextBox on the client when using Firefox.
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="input.aspx.vb" Inherits="TestaTredjepartWeb.input" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:ScriptManager ID="s" runat="server">
            <telerik:RadNumericTextBox ID="aa" runat="server" Value="10000000">
            </telerik:RadNumericTextBox><br /><br />
            <asp:Button ID="btnSetFocus" runat="server" Text="Set Focus" OnClientClick="$find('aa').focus(); return false;" />

    When pressing the "Set Focus" button, the input gets focus and selects all the text.
    So far everything is OK, but when clicking in the textbox after this (to edit the value at the clicked position), nothing happens (seems to select all text again).
    But when clicking the texbox a second time, the expected behavior happens (all text is not selected and the cursor is at the clicked position).

    This only happens in Firefox, in IE it is working as expected!

  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    1744 posts

    Posted 16 Oct 2014 Link to this post

    Hello Andreas,

    I have tested the scenario that you are describing and I was able to replicate the issue in Firefox and Chrome as well. Since this seems to be a bug with the current focus method of the RadInputControl, I will log it in our system, so our developers could further investigate the it and provide a fix in one of our future releases.

    For bringing this to our attention you will find your Telerik Points updated.

    As a temporarily workaround you could override on of the private methods of the RadInputControl as shown below:
        <script type="text/javascript">
            Telerik.Web.UI.RadInputControl.prototype._onTextBoxFocusHandler =  function (e)
                if (!this.isReadOnly())
                    if ($telerik.isIE) {
                        this._allowApplySelection = true;
                // selectiononfocus in Safari/Chrome/FF when tabbing
                if (($telerik.isSafari || $telerik.isFirefox) &&
                             this.get_selectionOnFocus() != Telerik.Web.UI.SelectionOnFocus.None &&
                             this.get_selectionOnFocus() != Telerik.Web.UI.SelectionOnFocus.SelectAll)
                    var thisobj = this;
                    window.setTimeout(function () { thisobj._triggerDomEvent("mouseup", thisobj._textBoxElement); }, 1);

    Please excuse us for any inconvenience caused by this.

    Best Regards,
    Konstantin Dikov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top