Results 1 to 5 of 5

Thread: ExtJS Menu shows also system menu

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Answers
    2

    Default Answered: ExtJS Menu shows also system menu

    Hi guys,

    I have the following problem. I created an iframe like the following:

    Code:
                {
                    region: 'center',
                    xtype: "component",
                    id: 'website-iframe',
                    style: {
                        width: '100%'
                    },
                    autoEl: {
                        tag : "iframe",
                        src: 'http://google.com/'
                    },
                    listeners: {
                        el: {
                            load: function(e, t, eOpts) {
                                Ext.getCmp('content-panel').setLoading(false);
                            },
                            contextmenu: function( e, t, eOpts ) {
                                alert('aa');
                                e.preventDefault();
                            }
                        }
                    }
                },
    then at some point in time I create a context menu over the iframe using this:
    Code:
                    var contextMenu = Ext.create('Ext.menu.Menu',{
                        items: [
                            {
                                itemId : 'edit',
                                text: 'Edit',
                                iconCls: 'edit'
                            },
                            {
                                itemId : 'remove',
                                text: 'Remove',
                                iconCls: 'remove',
                            },
                            {
                                itemId : 'add',
                                text: 'Add',
                                iconCls: 'add',
                            }
                        ]
                    });
                    
                    
                    contextMenu.showAt(300, 300, true);
    It all works good on linux (ff or chrome) and I can see my menu. However on Windows (ff or chrome) what happens is my custom menu appears, and immediately on top of it I see the browser system context menu, which hides it ... I really think it's a bug (please see the screenshot), but if you have some suggestion how to overcome this, I would be glad to try it.

    Thanks, and keep up the good work.ctx-menu.png

  2. Hi Scott,

    I started playing with the jsfiddle to prepare an example, and after several hours (yes my is pretty complicated), I found out the problem was in Jquery. I was having
    Code:
    $('div[id^="mydiv"]').bind({
    		mousedown: function(e) {
                   	        e.stopPropagation();                            			e.preventDefault();
    			e.stopImmediatePropagation();
    
                            //do the  here..
                    }
    and even with those 3 stops the event somehow was propagated. So I ended up with:
    Code:
       <div oncontextmenu="javascript:doTheHere();return false;"></div>
    and the return false seems to stop the event propagation.

    HTH someone else.

  3. #2
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Answers
    2

    Default

    I'm really astonished - how come this is not a bug????

  4. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716

    Default

    Please create a working example:
    https://fiddle.sencha.com/#home

    Perhaps using something like?

    Code:
    listeners: {
        itemcontextmenu: function(view, rec, node, index, e) {
            e.stopEvent();
            menuContext.showAt(e.getXY());
            return false;
        }
    }

  5. #4
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Answers
    2

    Default

    Hi Scott,

    I started playing with the jsfiddle to prepare an example, and after several hours (yes my is pretty complicated), I found out the problem was in Jquery. I was having
    Code:
    $('div[id^="mydiv"]').bind({
    		mousedown: function(e) {
                   	        e.stopPropagation();                            			e.preventDefault();
    			e.stopImmediatePropagation();
    
                            //do the  here..
                    }
    and even with those 3 stops the event somehow was propagated. So I ended up with:
    Code:
       <div oncontextmenu="javascript:doTheHere();return false;"></div>
    and the return false seems to stop the event propagation.

    HTH someone else.

  6. #5
    Sencha User
    Join Date
    Feb 2014
    Posts
    1

    Default

    I have this same issue.

Posting Permissions

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