Opened 8 years ago

Last modified 8 years ago

#12802 reopened defect

Menu: broken when declared inside a TitlePane

Reported by: macintyrei Owned by:
Priority: low Milestone: 2.0
Component: Dijit Version: 1.6.0
Keywords: menu tooltip TitlePane error Cc:
Blocked By: Blocking:

Description

Hi, the following markup which has a popup menu inside a TitlePane? breaks v1.6 (and 1.6.1rc) with a number of javascript errors, and a non functioning popup menu. This worked ok in 1.5.

<div dojoType="dijit.TitlePane" title="hello">
	<a href="#" id="a" >link</a>
	<div dojoType="dijit.Menu" targetNodeIds="a" style="display: none;">
		<div dojoType="dijit.MenuItem" label="menuitem"></div>
	</div>
</div>

The errors reported in firebug are as follows

TypeError: node is null
(953 out of range 568)
bootstrap.js (line 953)
Error parsing in _ContentSetter#Setter_dijit_TitlePane_0_pane_0
TypeError: node is null
[Break On This Error] (953 out of range 568)
bootstrap.js (line 953)
bootstrap.js (line 1041)
Error undefined running custom onLoad code: This deferred has already been resolved
(915 out of range 286)

In addition the following also fails to work, although no errors are reported

<div dojoType="dijit.TitlePane" title="hello">
	<a href="#" id="a" >link</a>
	<div dojoType="dijit.Tooltip" connectId="a" style="display: none;">
		I am a tooltip
	</div>	
</div>

Change History (4)

comment:1 Changed 8 years ago by bill

Resolution: duplicate
Status: newclosed

Dup of #12665.

comment:2 Changed 8 years ago by macintyrei

I didn't spot the duplicate as it focuses on the tooltip issue I was looking for the menu issue - sorry about that. Anyway, the workaround for that is fine, and it led me to subclassing dijit.Menu for fixing that issue (in our circumstances anyway)

dojo.provide("components.PopupMenu");

dojo.require("dijit.Menu");

dojo.declare("components.PopupMenu", dijit.Menu, {
    patchTargets: undefined,
    
    postCreate: function() {
        // take note of the targetNodeIds
        this.patchTargets = this.targetNodeIds;
        // now blank the variable so that super.postCreate doesn't act on it
        this.targetNodeIds = undefined;
 
        this.inherited(arguments);
    },
    
    startup: function() {
        this.inherited(arguments);
        
        // if contextMenuForwindow is set then that will have been handled in dijit.Menu / postCreate
        if(!this.contextMenuForWindow){
            // copied from dijit.Menu / postCreate
            dojo.forEach(this.patchTargets, this.bindDomNode, this);
        }
    }
});

comment:3 Changed 8 years ago by bill

Milestone: tbd2.0
Resolution: duplicate
severity: majornormal
Status: closedreopened
Summary: tooltips / popupmenus broken when declared inside a TitlePane using html markupMenu: broken when declared inside a TitlePane

Ah right, I didn't realize that this bug occurs in two different pieces of code (for Tooltips and Menus), I'll reopen this ticket for the Menu issue. And, glad the workaround is working for you

comment:4 Changed 6 years ago by bill

Priority: highlow
Note: See TracTickets for help on using tickets.