ICEfaces
  1. ICEfaces
  2. ICE-1420

Modal dialog doesn't work with absolute positioning + docytype

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.6DR#4, 1.6
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      any

      Description

      Here's the description of the problems that we experimented using the modal
      popup panel in a page where the DOCTYPE is declared.

      When a modal popup is opened, the opening page should be disabled; but when the
      the DOCTYPE is declared, the opening page is still modifiable.

      Our pages contain DIV elements with absolute positioning (we avoid TABLE
      elements for accessibility reasons) and when the DOCTYPE is declared the
      ICEFACES javascript functions do not work properly.

      In fact, ICEFaces uses this IFRAME for creating a layer which proceduces the
      "disabled" effect:

       

      <iframe id="iceModalFrame" src="/sia-pr/xmlhttp/blank.iface" style="z-index:
      25000; opacity: 0.5; position: absolute; visibility: visible; background-color:
      black; top: 0pt; left: 0pt; width: 1280px; height: 0px;">

       

      As you can see, the "height" property value is "0px", so the layer which should
      produce the disabled effect can't cover the opening page. ICEFaces calculates
      this value using the "Ice.modal.start" javascript function:

       

      _2c7.style.width=document.body.clientWidth+"px";

      _2c7.style.height=document.body.clientHeight+"px";

       

      But the javascript code of the "Ice.modal.start" function does not calculate the
      right height value because our pages have the following peculiarities:

       

      1) the DOCTYPE DECLARATION

      2) DIV with absolute positioning

       

      In fact, when absolute positioning is used in conjunction whith the DOCTYPE
      declaration, the body height (accorinding to the DOM engine of the browser)
      seems to be 0.

      If just the DOCTYPE declaration is removed, the javascript functions work
      properly, in fact this is the IFRAME which is created in that situation:

       

      <iframe id="iceModalFrame" src="/sia-pr/xmlhttp/blank.iface" style="z-index:
      25000; opacity: 0.5; position: absolute; visibility: visible; background-color:
      black; top: 0pt; left: 0pt; width: 1280px; height: 912px;">

       

      As you can see,now the height value is correct.

       

      We tried patching that javascript using the following code and it worked fine:

       

      function setMaskSize(transparentLayer) {

       

            var theBody = document.getElementsByTagName("BODY")[0];

            var fullHeight = getViewportHeight();

            var fullWidth = getViewportWidth();

       

           

            // Determine what's bigger, scrollHeight or fullHeight / width

            if (fullHeight > theBody.scrollHeight) {

                  popHeight = fullHeight;

            } else {

                  popHeight = theBody.scrollHeight;

            }

           

            if (fullWidth > theBody.scrollWidth) {

                  popWidth = fullWidth;

            } else {

                  popWidth = theBody.scrollWidth;

            }

       

            transparentLayer.style.height = popHeight + "px";

            transparentLayer.style.width = popWidth + "px";

      }

       

       

       

      function getViewportHeight() {

            if (window.innerHeight!=window.undefined) return window.innerHeight;

            if (document.compatMode=='CSS1Compat') return
      document.documentElement.clientHeight;

            if (document.body) return document.body.clientHeight;

       

            return window.undefined;

      }

       

      function getViewportWidth() {

            if (window.innerWidth!=window.undefined) return window.innerWidth;

            if (document.compatMode=='CSS1Compat') return
      document.documentElement.clientWidth;

            if (document.body) return document.body.clientWidth;

            return window.undefined;

      }

       

      setMaskSize(_2c7)

        Issue Links

          Activity

          Hide
          Philip Breau added a comment -

          contributor: Claudio Tasso, KION

          Show
          Philip Breau added a comment - contributor: Claudio Tasso, KION
          Hide
          Philip Breau added a comment -

          I think it's a different issue. Here the problem is that the window size calculation isn't working at all.

          Show
          Philip Breau added a comment - I think it's a different issue. Here the problem is that the window size calculation isn't working at all.
          Hide
          Mircea Toma added a comment -

          This is a component level issue.

          Show
          Mircea Toma added a comment - This is a component level issue.
          Hide
          Ken Fyten added a comment -

          These two issues relate to different features; bridge error message popup and modal panelPopup but the underlying algorithm used to position and size the element that provides the modality should be the same.

          We should synchronize the efforts for these two issues.

          Show
          Ken Fyten added a comment - These two issues relate to different features; bridge error message popup and modal panelPopup but the underlying algorithm used to position and size the element that provides the modality should be the same. We should synchronize the efforts for these two issues.
          Hide
          Mircea Toma added a comment -

          Apply same technique as in ICE-ICE-1289.

          Show
          Mircea Toma added a comment - Apply same technique as in ICE- ICE-1289 .
          Hide
          Mircea Toma added a comment -

          I used only Javascript to resolve the issue. I wasn't able to use CSS because IE6 does not support 'fixed' positioning.

          Show
          Mircea Toma added a comment - I used only Javascript to resolve the issue. I wasn't able to use CSS because IE6 does not support 'fixed' positioning.

            People

            • Assignee:
              Unassigned
              Reporter:
              Philip Breau
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: