ICEfaces
  1. ICEfaces
  2. ICE-6333

Links disabled after setting modal Popup to non-rendered

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2-EE-GA_P02
    • Fix Version/s: EE-1.8.2.GA_P03
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      n/a
    • Workaround Exists:
      Yes
    • Workaround Description:
      use the visible attribute instead of the rendered attribute

      Description

      When using a PanelPopup component, setting the rendered attribute from true to false causes all links on a page to become disabled. All links, even those outside of the rendered ICEfaces content, such as those in other portlets or a theme in a portal environment, become disabled. Only refreshing the page will re-enable the links. This seems to be due to some new Javascript code in style.js which 'deregisters' certain events on elements on the page when a modal overlay is activated. The events are 're-registered' when the modal overlay is deactivated, but this requires the PanelPopup to remain in the rendered state. If the popup is no longer rendered after the events are deregistered, they will not be reregisterd, even though the modal overlay is no longer active.

      The following code in style.js Ice.modal.start() is responsible for the event deregistration, so this bug probably also applies to the other elements and events listed there, namely, 'input', 'select', 'textarea' and 'button'.

      'input', 'select', 'textarea', 'button', 'a'].each(function(type) {
                      $enumerate(document.body.getElementsByTagName(type)).each(function(e) {
                          if (!childOfTarget(e)) {
                              var onkeypress = e.onkeypress;
                              var onkeyup = e.onkeyup;
                              var onkeydown = e.onkeydown;
                              var onclick = e.onclick;
                              e.onkeypress = none;
                              e.onkeyup = none;
                              e.onkeydown = none;
                              e.onclick = none;

                              rollbacks.push(function() {
                                  try {
                                      e.onkeypress = onkeypress;
                                      e.onkeyup = onkeyup;
                                      e.onkeydown = onkeydown;
                                      e.onclick = onclick;
                                  } catch (ex) {
                                      logger.error('failed to restore callbacks on ' + e, ex);
                                  }
                              });
                          }
                      });
      1. modal-popup-P02.JPG
        10 kB
      2. modal-popup-patch.JPG
        10 kB

        Issue Links

          Activity

          Hide
          Philip Breau added a comment -

          Comp showcase (built for Tomcat 6) demonstrating issue:

          1. go to panel popup example
          2. click on button activating modal popup
          3. close popup
          4. try clicking on links in the navigation panel

          Show
          Philip Breau added a comment - Comp showcase (built for Tomcat 6) demonstrating issue: 1. go to panel popup example 2. click on button activating modal popup 3. close popup 4. try clicking on links in the navigation panel
          Hide
          Ken Fyten added a comment -

          This appears to be a side-effect of the following:

          ICE-4975 - BlockUIOnSubmit does not prevent keyboard interaction
          ICE-5223 - Buttons in the main page under modal popup gets activated by accesskey sequence (Alt+Shift+accesskey)

          And especially late commits for:

          ICE-5652 - UpdateElements.coalesceWithPrevious overwrites JavaScript calls

          Note that setting rendered=false without first setting visible=false never worked to remove modal popups prior to 1.8.2 either, for other reasons.

          Show
          Ken Fyten added a comment - This appears to be a side-effect of the following: ICE-4975 - BlockUIOnSubmit does not prevent keyboard interaction ICE-5223 - Buttons in the main page under modal popup gets activated by accesskey sequence (Alt+Shift+accesskey) And especially late commits for: ICE-5652 - UpdateElements.coalesceWithPrevious overwrites JavaScript calls Note that setting rendered=false without first setting visible=false never worked to remove modal popups prior to 1.8.2 either, for other reasons.
          Hide
          Ken Fyten added a comment -

          A related fix has been made for this on the IF 2.0 trunk (ICE-6413).

          Show
          Ken Fyten added a comment - A related fix has been made for this on the IF 2.0 trunk ( ICE-6413 ).
          Hide
          Mircea Toma added a comment - - edited

          Used Ice.onAsynchrounousReceive function to register a callback that verifies (each time a DOM update is received) if the modal popup markup is still rendered. In case the popup markup is not rendered the Ice.modal.stop() function is invoked which in turn restores the event handlers of the elements hidden by the modal overlay.

          Show
          Mircea Toma added a comment - - edited Used Ice.onAsynchrounousReceive function to register a callback that verifies (each time a DOM update is received) if the modal popup markup is still rendered. In case the popup markup is not rendered the Ice.modal.stop() function is invoked which in turn restores the event handlers of the elements hidden by the modal overlay.
          Hide
          Tyler Johnson added a comment -

          The current fix works when there is a single popup but does not for multiple popups rendered in succession. Test case attached.

          Show
          Tyler Johnson added a comment - The current fix works when there is a single popup but does not for multiple popups rendered in succession. Test case attached.
          Hide
          Mircea Toma added a comment -

          Changed popup disposal code to work even when old popup is disposed after the new one is rendered. This use case occurs when popups are opened serially, like in the attached test case. Unfortunately Ice.onAsynchronousReceive callbacks are invoked only after the DOM updates are applied, thus the callback calling Ice.modal.stop() function for the previous popup is called only after the update creating the next popup is applied. This use case used to confuse the popup disposal code.

          Show
          Mircea Toma added a comment - Changed popup disposal code to work even when old popup is disposed after the new one is rendered. This use case occurs when popups are opened serially, like in the attached test case. Unfortunately Ice.onAsynchronousReceive callbacks are invoked only after the DOM updates are applied, thus the callback calling Ice.modal.stop() function for the previous popup is called only after the update creating the next popup is applied. This use case used to confuse the popup disposal code.
          Hide
          Tyler Johnson added a comment - - edited

          Attaching a test case that shows the patch failing when setting the blockUIOnSubmit parameter to true. The example is ready for deployment on Tomcat 6 and contains instructions on how to reproduce.

          Show
          Tyler Johnson added a comment - - edited Attaching a test case that shows the patch failing when setting the blockUIOnSubmit parameter to true. The example is ready for deployment on Tomcat 6 and contains instructions on how to reproduce.
          Hide
          Mircea Toma added a comment -

          The blockUI feature is replacing the event handlers of the input elements with No-Op functions while the modal popup does the same thing (a bit later) but saving the No-Op functions put in by blockUI. When modal popup is closed the original event handlers restored by the blockUI feature are overwritten by the No-Op functions that the modal popup picked. So some elements remain in effect disabled because of the overlapping that occurs between blockUI and modal popup processes.

          The solution applied marks the elements that have their event handlers disabled to avoid disabling twice the handlers when modal popup is used in conjunction with blockUI.

          Show
          Mircea Toma added a comment - The blockUI feature is replacing the event handlers of the input elements with No-Op functions while the modal popup does the same thing (a bit later) but saving the No-Op functions put in by blockUI. When modal popup is closed the original event handlers restored by the blockUI feature are overwritten by the No-Op functions that the modal popup picked. So some elements remain in effect disabled because of the overlapping that occurs between blockUI and modal popup processes. The solution applied marks the elements that have their event handlers disabled to avoid disabling twice the handlers when modal popup is used in conjunction with blockUI.
          Hide
          Arran Mccullough added a comment -

          I found a potential issue with the fixes that have been made for this issue in regards to multiple modal popups. Before the fixes (ICEfaces EE 1.8.2 P02) if a second modal popup is displayed from a modal popup, the modal background of the second popup would cover the first popup. Using a patched build with this code, or the current trunk, the second modal background goes behind the first modal popup which allows the user to interact with this first popup.

          This issue is also only seen when the popups are declared in different forms. I also notices that if you use the visible attribute instead of the rendered attribute to show/hide the popups this behavior is not seen.

          I've attached some screen shots and a test case that shows this issue.

          Show
          Arran Mccullough added a comment - I found a potential issue with the fixes that have been made for this issue in regards to multiple modal popups. Before the fixes (ICEfaces EE 1.8.2 P02) if a second modal popup is displayed from a modal popup, the modal background of the second popup would cover the first popup. Using a patched build with this code, or the current trunk, the second modal background goes behind the first modal popup which allows the user to interact with this first popup. This issue is also only seen when the popups are declared in different forms. I also notices that if you use the visible attribute instead of the rendered attribute to show/hide the popups this behavior is not seen. I've attached some screen shots and a test case that shows this issue.
          Hide
          Mircea Toma added a comment -

          The last used z-index is decremented when callbacks registered with ice.onAfterUpdate are executed even though the targeted popups are not rendered. To fix the issue the last used z-index is decremented only when Ice.menu.stop function is invoked for a popup that is running/rendered.

          Show
          Mircea Toma added a comment - The last used z-index is decremented when callbacks registered with ice.onAfterUpdate are executed even though the targeted popups are not rendered. To fix the issue the last used z-index is decremented only when Ice.menu.stop function is invoked for a popup that is running/rendered.

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Philip Breau
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: