Results 1 to 4 of 4

Thread: Ext.menu.Menu infinite loop

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Aug 2014
    Location
    Bath, UK
    Posts
    26

    Default Ext.menu.Menu infinite loop

    Ext version tested:
    • Ext 5.1.0.107 CLassic
    Browser versions tested against:
    • Chrome
    Description:
    • When typing keys into a menu that has no menu items with no text the browser can hang.
    Steps to reproduce the problem:

    I've made a copy of a different Sechan fiddle and used that. See:

    https://fiddle.sencha.com/#fiddle/sk3

    To reproduce: Open the number menu and select an option and sort the grid.
    Open the number menu again, start typing.

    Sometimes the browser freezes completely.The problem is in the onShortcutKey method in Ext.menu.Menu. Specifically:

    Code:
    onShortcutKey: function(keyCode, e) {
        var shortcutChar = String.fromCharCode(e.getCharCode()),
                items = this.query('>[text]'),
                len = items.length,
                item = this.lastFocusedChild,
                focusIndex = Ext.Array.indexOf(items, item),
                i = focusIndex;
    
    
            // Loop through all items which have a text property starting at the one after the current focus.
            for (;;) {
                if (++i === len) {
                    i = 0;
                }
                item = items[i];
    
    
                // Looped back to start - no matches
                if (i === focusIndex) {
                    return;
                }
                
                // Found a text match
                if (item.text && item.text[0].toUpperCase() === shortcutChar) {
                    item.focus();
                    return;
                }
            }
    
        },
    If the previously focussed menu item is an item that has no text field then
    Code:
    focusIndex = Ext.Array.indexOf(items, item)
    will be -1 and the loop will never finish because:

    i will never be === -1.

  2. #2
    Sencha User
    Join Date
    Aug 2014
    Location
    Bath, UK
    Posts
    26

    Default

    One further note. The code in the Ext 6.0 build looks the same, so probably a bug there too.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2014
    Posts
    1

    Default Fiddle

    The fiddle must have changed or something. It is about something else. I have it reproduced here, though: https://fiddle.sencha.com/#fiddle/16av

  4. #4
    Sencha Premium User westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,038

    Default

    Still looks to be an issue in Ext 6.7.0...
    Product Architect
    Altus Ltd.

Similar Threads

  1. Replies: 0
    Last Post: 20 Oct 2011, 2:45 PM
  2. Replies: 1
    Last Post: 26 Feb 2010, 2:06 PM
  3. Mouse click does not work on menu items(when menu is rendered as context menu)
    By anilcs0405 in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 3 Aug 2009, 5:55 AM
  4. Replies: 3
    Last Post: 8 Apr 2008, 11:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •