Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Ext.menu.Item changes the hash to # when clicking on Windows 10 Touch Screens

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-17945 in 5.1.3.
  1. #11
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    5

    Default

    Was anyone able to fix that problem with an override? Thanks!

  2. #12
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    5

    Default

    Even a diff of what has changed with EXTJS-17945 would help a lot - then I can write the override on my own.
    Thanks again!

  3. #13
    Sencha User
    Join Date
    Apr 2017
    Posts
    4

    Default Have the same problem with ExtJs 6.5.1 Modern

    Quote Originally Posted by brusch View Post
    Was anyone able to fix that problem with an override? Thanks!
    Its seems like the event isn't really stopped with the e.stopEvent(); in the Ext.menu.Item. Trying with chrome and using the chrome://flags Touch Events API set to enabled, it gives me the same result as one of my mates that has an hybrid device (an laptop with touch screen), on click on the menu item it jumps to the #-tag specified in the anchor for the menu items.

    And im running modern 6.5.1 ..

  4. #14
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    5

    Default

    The following override did the trick for me.

    Code:
    Ext.define(null, {
        override: 'Ext.menu.Menu',
    
    onBoxReady: function () {
            var me = this,
    iconSeparatorCls = me._iconSeparatorCls,
    keyNav = me.focusableKeyNav;
    
    // Keyboard handling can be disabled, e.g. by the DatePicker menu
            // or the Date filter menu constructed by the Grid
    if (keyNav) {
                keyNav.map.processEventScope = me;
    keyNav.map.processEvent = function (e) {
                    // ESC may be from input fields, and FocusableContainers ignore keys from
                    // input fields. We do not want to ignore ESC. ESC hide menus.
    if (e.keyCode === e.ESC) {
                        e.target = this.el.dom;
    }
    
                    return e;
    };
    
    // Handle ESC key
    keyNav.map.addBinding([{
                    key: Ext.event.Event.ESC,
    handler: me.onEscapeKey,
    scope: me
                },
    // Handle character shortcuts
    {
                        key: /[\w]/,
    handler: me.onShortcutKey,
    scope: me,
    shift: false,
    ctrl: false,
    alt: false
    }
                ]);
    } else {
                // Even when FocusableContainer key event processing is disabled,
                // we still need to handle the Escape key!
    me.escapeKeyNav = new Ext.util.KeyNav(me.el, {
                    eventName: 'keydown',
    scope: me,
    esc: me.onEscapeKey
    });
    }
    
            me.callSuper(arguments);
    
    // TODO: Move this to a subTemplate When we support them in the future
    if (me.showSeparator) {
                me.iconSepEl = me.body.insertFirst({
                    role: 'presentation',
    cls: iconSeparatorCls + ' ' + iconSeparatorCls + '-' + me.ui,
    html: ' '
    });
    }
    
            // Modern IE browsers have click events translated to PointerEvents, and b/c of this the
            // event isn't being canceled like it needs to be. So, we need to add an extra listener.
            // For devices that have touch support, the default click event may be a gesture that
            // runs asynchronously, so by the time we try and prevent it, it's already happened
    
            // we use Ext.supports.TouchEvents here, because we're overriding Ext.supports.Touch in edit/startup.js (Editmode)
    if (Ext.supports.TouchEvents || Ext.supports.MSPointerEvents || Ext.supports.PointerEvents) {
                me.el.on({
                    scope: me,
    click: me.preventClick,
    translate: false
    });
    }
    
            me.mouseMonitor = me.el.monitorMouseLeave(100, me.onMouseLeave, me);
    }
    });

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [FIXED] Clicking on a context menu but not on a menu item raises error.
    By JimGrimmett in forum Ext 5: Bugs
    Replies: 2
    Last Post: 11 Feb 2015, 1:07 PM
  2. [DUP] Click on Menu item deletes URL hash in IE
    By greatranil in forum Ext 5: Bugs
    Replies: 1
    Last Post: 13 Nov 2014, 9:06 AM
  3. [DUP] clicking menu item clears fragment id
    By urban.novak in forum Ext 5: Bugs
    Replies: 1
    Last Post: 4 Nov 2014, 9:07 AM
  4. stop menu from closing when clicking combo in form that is a menu item
    By giovanni in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 10 Mar 2011, 11:01 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
  •