Opened 12 years ago

Closed 11 years ago

#4874 closed defect (wontfix)

Menu: must hide menu with style="display: none"; indirectly via a class doesn'twork

Reported by: guest Owned by: bill
Priority: low Milestone: 1.3
Component: Dijit Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

If you create a menu but initially hide it via a CSS rule like:

 .menu1 {
      display:none;
}

rather than

style="display: none"
}}

Then it doesn't display when the user right-clicks.

Attachments (1)

dijitTestMenuItem.html (2.1 KB) - added by guest 12 years ago.
Use this file - it demonstrates the problem more clearly.

Download all attachments as: .zip

Change History (14)

Changed 12 years ago by guest

Attachment: dijitTestMenuItem.html added

Use this file - it demonstrates the problem more clearly.

comment:1 Changed 12 years ago by bill

severity: majorminor

If you do

menu.domNode.style.display="none";

rather than doing it indirectly through a class, then it works, right?

I don't think this has anything to do with programmatic creation but rather just with the (unfortunately undocumented) way that you have to initially hide the element.

comment:2 Changed 12 years ago by bill

Milestone: 2.0
Resolution: wontfix
Status: newclosed

comment:3 Changed 12 years ago by guest

Resolution: wontfix
Status: closedreopened

Well thanks for the this info. However, where is the documentation on how to do this? Also - in some cases you can do dojo.addClass(some.domNode, "someClass") and in some cases not. This speaks directly to consistency in the programming model. And this is actually what concerns me the most. There must be a consistent way to build and wire up widgets. Specific ways for building each widget indicates an inconsistency in the programming model. And this in turn speaks to immaturity of design and/or implementation. That is the real problem. What has been provided here is a workaround, not a fix.

comment:4 Changed 12 years ago by bill

Documentation for programmatic creation is just the test files themselves. Maybe someday it'll be in the actual documentation on the website. I'll leave this bug open for now, to make sure it's documented.

comment:5 Changed 12 years ago by bill

Priority: highlow

comment:6 Changed 12 years ago by bill

Summary: A Menu built programmatically does not display menu itemsMenu: must hide menu with style="display: none"; indirectly via a class doesn'twork

comment:7 Changed 12 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

comment:8 Changed 12 years ago by bill

Description: modified (diff)

Dijit code might be able to use s CSS class w/!important to hide/show menu (and other widgets like Dialog), rather than setting style on the node indirectly.

comment:9 Changed 12 years ago by bill

Description: modified (diff)

comment:10 Changed 11 years ago by bill

Milestone: 1.31.4

bumping 1.4 tickets to 1.5, and most 1.3 tickets to 1.4

comment:11 Changed 11 years ago by bill

I started using classes for hiding/showing in [15926]. Menu can probably just use display:none rather than rendering offscreen, but the same pattern can be applied.

comment:12 Changed 11 years ago by bill

Milestone: 1.41.3
Owner: set to bill
Status: reopenednew

Update: dijitVisible and dijitHidden are now just display:none and display:"", so those classes can be used for Menu.

Problem is that the code in question is not just Menu.js but also popup.js, which as of [12162] is doing visibility:hidden.

However, after [15974], looks like [12162] is no longer necessary. Nor is [12161].

I'll fix this so (as originally requested) hiding via a class works.

comment:13 Changed 11 years ago by bill

Resolution: wontfix
Status: newclosed

I tried to fix this by using dijitVisible and dijitHidden CSS classes for everything.

It turns out to be problematic because the dijitVisible class, in order to override a display:none specified via style or via another class, specifies display: block, which isn't kosher for things like ColorPalette (which is painstakingly defined to be inline-block), or for Menu itself (which is a table, and should be display:table). Things seemed to work in most cases, though ColorPalette was becoming too wide on IE6, but besides the ColorPalette problem I worry in general, because setting display to something that it shouldn't be could cause unforseen problems.

So, I updated the documentation for Menu etc.to clearly state to use style="display: none", and I'll leave it at that. I decided not to use the classes, because it's too risky.

Note: See TracTickets for help on using tickets.