Wicket
  1. Wicket
  2. WICKET-1502

Slow opening of ModalWindow for complex pages

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.5
    • Component/s: wicket-extensions
    • Labels:
      None
    • Environment:
      Firefox 2

      Description

      I'm experiencing bad performance when opening a ModalWindow. Profiling it with Firebug I found that the hot spot is modal.js -> disableFocus() -> disableFocusElement() (which is recursive and iterates over all children of <body>).
      I have a (relatively) complex page with a modal window and Firebug profiler shows these results:
      disableFocusElement 9823 81.72% 1379.189ms 1379.189ms 0.14ms 0.014ms 768.042ms modal.js (line 1373)
      bind 9 2.9% 48.908ms 49.861ms 5.54ms 0.098ms 45.192ms modal.js (line 408)
      ....

      As you see there are ~10000 calls to disableFocusElement (i.e. there are ~10000 sub-elements of <body>).

      The following patch improves the performance and still remains the functionality:

      Index: src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
      ===================================================================
      — src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js (revision 646196)
      +++ src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js (working copy)
      @@ -1251,9 +1251,9 @@
      this.document = doc;

      // disable user interaction

      • this.hideSelectBoxes();
      • this.disableTabs();
      • this.disableFocus();
        + setTimeout(function() {this.hideSelectBoxes()}

        .bind(this), 300);
        + setTimeout(function()

        {this.disableTabs()}

        .bind(this), 400);
        + setTimeout(function()

        {this.disableFocus()}.bind(this), 1000);
        },


        Note: calling "setTimeout(function() {this.disableFocus()}

        .bind(this), 500);" didn't help in my case. It needs to be bigger.
        The user experience is good and I don't see any drawbacks of this modification.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Matej Knopp
            Reporter:
            Martin Grigorov
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development