Slow opening of ModalWindow for complex pages
---------------------------------------------

                 Key: WICKET-1502
                 URL: https://issues.apache.org/jira/browse/WICKET-1502
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-extensions
    Affects Versions: 1.3.2
         Environment: Firefox 2
            Reporter: Martin Grigorov
            Priority: Minor


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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to