Loading ...
Sorry, an error occurred while loading the content.

44632Problem with context menu rendering in IFRAME

Expand Messages
  • Robert P. Goldman
    Feb 3 7:11 AM
    • 0 Attachment
      I have been building a web application in which text is generated into
      an IFRAME. This iframe contains spans, to some of which I have
      attached a context menu. The context menu is working properly in the
      sense that it pops up in response to clicks on the span elements, and
      the callback functions, but the positioning and styling of the context
      menu is all wrong.

      In particular, although I attached the context menu to the iframe's
      contentDocument.body, it appears positioned over the document of the
      main page. It seems like it's using some incorrect relative
      positioning. That is, when it pops up, it pops up at the top of the
      page, not over the IFRAME, which is at the bottom of the page.
      HOWEVER, if I move to different spans, and pop the context menu up
      multiple times, then the position of the context menu appears to
      change in agreement with the relative positions of the triggering spans.

      In addition to this problem, the menu seems to be skinned wrong.
      Instead of seeing a nice-looking widget, I see what looks like a raw
      HTML UL --- the menu items appear as bulleted text, rendered as a link
      (blue text, underlined), and there's no box around them.

      I have put the following in the header of the web page:
      <!-- Fonts CSS - Recommended but not required -->
      <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/2.6.0/build/fonts/fonts-min.css">
      <!-- Combo-handled YUI CSS files: -->
      <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/combo?2.6.0/build/menu/assets/skins/sam/menu.css">

      and then, in desperation, put them in the head component of the
      iframe's document, as well. This doesn't seem to change anything.

      There is an example of a context menu attached to an IFRAME on the YUI
      site, but that context menu is attached to the document, and the
      entire IFRAME is its trigger, so it doesn't help me much with this
      problem.

      Here's something interesting, if it helps. I make the following call
      in my javascript for making the context menu:

      oContextMenu.render(iframe.contentDocument.body);

      However, when I look at the HTML of the page, using Firebug, I see
      that the context menu is a child of the PARENT document's body, and
      not a child of the iframe's contentDocument's body.

      I suspect that there's probably something very simple that I'm missing
      here. Any help would be very much appreciated.
    • Show all 2 messages in this topic