[CLOSED] Toolbar item remains selected after click

Page 2 of 2 FirstFirst 12
  1. #11
    Probably, no. It is the new functionality in ExtJS 5.1.0 for accessibility purposes. We will have to go with that, anyways. Moreover, it probably makes a lot of sense. The only unfortunate thing - no global setting to turn it off, but you can do for components the same thing that Fabricio suggested for Buttons.

    By the way, we have added the Focusable server side property for the AbstractComponent class. Hope this helps.
  2. #12
    Thank you Daniil. Please mark this thread as closed.
  3. #13
    As for the workaround, you just use this override:
    Ext.define('Ext.button.Button', {
        override: 'Ext.button.Button',
        focusable: false,
    });
    And the buttons behavior will be back at how it was on Ext.NET 2.5 (actually.. ExtJS 4.x).

    On the new ExtJS version, by default any button is navigable thru keyboard, and have a visual feedback for it. I've checked ordinary buttons on Ext.NET 2.5 and they're also not selectable (dotted outline).

    I happened to find this website in my search and, it seems that could have been a reason ExtJS changed its buttons behavior to this. Not sure though, as the 'outline' css prop is still as disabled.

    I hope this helps you fix your view there! :)
    The "problem" (as it might have been proposital) is that when any button if focused now, the x-focus, x-btn-focus and other focus-related classes are bound to the button.

    Also, it should have meant to look good on the new themes, and just slipped past the default gray theme. If you look closely to the Crisp theme, it sets a blueish shadow to the selected button on the same example, which just differs on CSS effects from the gray theme.
    There is a side effect. On the following example, click on Click Me button. Alert is shown but Ok button is not focused, so alert is not closed when Enter or Space key is pressed.
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <script type="text/javascript">
            Ext.define('Ext.button.Button', {
                override: 'Ext.button.Button',
                focusable: false,
            });
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Button Text="Click Me" runat="server">
            <Listeners>
                <Click Handler="Ext.Msg.alert('Information', 'Ext.Net');" />
            </Listeners>
        </ext:Button>
    </body>
    </html>
    I am gonna try to find a more stable approach.
    Last edited by RCN; Feb 04, 2015 at 6:35 PM.
  4. #14
    Blur the button when it is clicked is "safer" than overriding button's focusable behaviour.

    It prevents the issue presented on this thread and the issue that was included by overriding button's focusable behaviour (Post #13).

    Hope this helps.

    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <script type="text/javascript">
            Ext.button.Button.override({
                onClick: function (e) {
                    this.callParent(arguments);
                    this.blur();
                }
            });
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" Theme="Gray" ScriptMode="Debug" />
        <ext:TextField runat="server" />
        <ext:Panel runat="server">
            <TopBar>
                <ext:Toolbar runat="server">
                    <Items>
                        <ext:Button Text="Ext.Net" Icon="Information" runat="server" />
                    </Items>
                </ext:Toolbar>
            </TopBar>
        </ext:Panel>
    </body>
    </html>
    Last edited by RCN; Feb 10, 2015 at 5:47 PM.
  5. #15
    Blur the button when it is clicked is "safer" than overriding button's focusable behaviour.

    It prevents the issue presented on this thread and the issue that was included by overriding button's focusable behaviour (Post #13).

    Hope this helps.

    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <script type="text/javascript">
            Ext.button.Button.override({
                onClick: function (e) {
                    this.callParent(arguments);
                    this.blur();
                }
            });
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" Theme="Gray" ScriptMode="Debug" />
        <ext:TextField runat="server" />
        <ext:Panel runat="server">
            <TopBar>
                <ext:Toolbar runat="server">
                    <Items>
                        <ext:Button Text="Ext.Net" Icon="Information" runat="server" />
                    </Items>
                </ext:Toolbar>
            </TopBar>
        </ext:Panel>
    </body>
    </html>
    This approach breaks Toolbar's overflow. I will try to find another way to overcome presented in this thread. I will keep you posted.
    Last edited by RCN; Feb 11, 2015 at 6:04 PM.
  6. #16
    Hello Raphael,

    Thanks for the updates!

    When setting focusable=false, it is true that ordinary events such as _enter_ or _space_ wouldn't do it. The "problem" (some might assume that, some might not) in version 2, is that you were with cursor on a given button but you had absolutely no visual feedback about that. So, now as they changed the code, they ensured something visually shows where the cursor is.

    Maybe you could declare a css class that determines outline as none, and then set the specific button/control with that CSS class, to avoid higlighting that, specificly. But that's just an idea.
    Fabrício Murta
    Developer & Support Expert
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 3
    Last Post: May 14, 2013, 4:03 AM
  2. Replies: 3
    Last Post: May 06, 2013, 6:44 AM
  3. Replies: 0
    Last Post: Apr 17, 2013, 7:41 AM
  4. [CLOSED] Click on MultiSelect deselects the selected item
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 27, 2013, 5:27 PM
  5. [CLOSED] combobox column in grid and get selected item on row click
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 23, 2011, 2:38 PM

Posting Permissions