Results 1 to 3 of 3

Thread: Clicking on a context menu but not on a menu item raises error.

    Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Sencha User
    Join Date
    Aug 2014
    Location
    Bath, UK
    Posts
    26

    Default Clicking on a context menu but not on a menu item raises error.

    Ext version tested:
    • Ext 5.1.0.107
    Browser versions tested against:
    • IE11
    Description:
    If you have the Classic theme chosen, then there is padding (margin/boarder whatever) around a menu item. It is quite possible to click on the menu itself but not on an item. In that case, and in IE11 only you will see the following in the logs:

    Error: Unable to get property 'href' of undefined or null reference
    File: Menu.js, Line: 689, Column: 9

    I've made a copy of an existing fiddle (from
    http://www.sencha.com/forum/showthread.php?290472 architectura's post) and changed the theme to classic.

    If you launch the fiddle:

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

    and click on the menu, but not on an item (a couple of pixels at the top of the menu) you will see the error in IE11 only. Tested in FF, Chrome, other IEs and not present there

    We have an override:

    replace
    Ext.menu.Menu's method:

    preventClick: function (e) {
    if (!this.getItemFromEvent(e).href) {
    e.preventDefault();
    }
    }

    with

    preventClick: function (e) {
    var item = this.getItemFromEvent(e);
    if (item && !item.href) {
    e.preventDefault();
    }
    }

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report. I do see this issue in version 5.1.0 (rather difficult to recreate.) I am not, however, seeing the problem when testing against the latest nightly, so it looks like this one's been fixed.

  3. #3
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    The current code reads exactly as you have suggested! Thanks for the post.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Posting Permissions

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