#9606 closed defect (fixed)
Menu: bugs when attaching menu to an iframe
Reported by: | Douglas Hays | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Dijit | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Run the attached menubug.html file.
You get an error: dijit.Menu._iframeContentDocument is not a function
This comes from Menu.js. Seemingly, this._iframeContentDocument should have been used.
I changed the 2 occurances in Menu.js and the exception goes away.
Then I scroll the iframe to the bottom and right click.
The context menu appears far below the mouse pointer.
This seems to be because the iframe scrolling was ignored.
I added this to _openMyself and that seems to have fixed that:
var scroll = dojo.withDoc(e.target.ownerDocument, "_docScroll", dojo); y -= scroll.y; x -= scroll.x;
I also noticed this line in bindDomNode that appears to be unneeded code:
var win = dijit.getDocumentWindow(node.ownerDocument);
Attachments (2)
Change History (12)
Changed 13 years ago by
Attachment: | menubug.html added |
---|
comment:1 Changed 13 years ago by
Milestone: | tbd → 1.4 |
---|---|
Status: | new → assigned |
Definitely an improvement. That <iframe> code in Menu isn't well tested because although menu was designed to work on an <iframe> so that Editor could use it, Editor isn't actually using it.
The patch as is though messes up menus menus on a main document when the main document is scrolled (try scrolling down test_Menu.html, at least on FF3.5/mac where I tested).
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [19093]) Changes to adjust coordinates for mouse click occurring on an <iframe>. Since Menu actually connecst to the <iframe>'s <body> node, the event.pageX and pageY are relative to the <iframe>, but we need them to be relative to the main document, where dojo is running.
Working everywhere (safari, FF, and IE) except for FF2 which shows the browser menu in addition to the dijit.Menu.
Fixes #9606 !strict.
comment:4 Changed 13 years ago by
Summary: | Menu: bugs when using iframes → Menu: bugs when attaching menu to an iframe |
---|
comment:5 Changed 13 years ago by
comment:6 Changed 13 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Still some open issues here:
- On FF and safari when the browser window itself is scrolled, the menu appears too high. I think this is caused by a general problem with dojo.coords(iframe), w/o the second parameter set to true.
- IE's menu placement is a little off. Perhaps the code shouldn't be including the iframe's border or padding into the calculation.
- If the iframe's content is changed (ie, src parameter is changed) or if the Menu is connected to the iframe before it finishes loading, then we lose the connection. That's because the Menu code is actually connecting to the <body> node inside of the iframe.
comment:7 Changed 13 years ago by
(In [19105]) Menu on iframe related fixes (refs #9606 !strict):
- Fix from Doug so that scrolling main document doesn't mess up menu position
- Rebind any time the iframe contents are reloaded (ie, any time the iframe src is changed). This is needed since a connection to an iframe is actually connecting the <body> node inside the iframe. (note: had to work-around broken dojo.connect(iframe, "onload), refs #9609).
comment:8 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
testcase