r66257 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66256‎ | r66257 | r66258 >
Date:04:45, 12 May 2010
Author:neilk
Status:deferred
Tags:
Comment:
trying to disable form fields when hidden so we don't tab through them; not quite working
Modified paths:
  • /trunk/extensions/UploadWizard/js/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js
@@ -1083,7 +1083,7 @@
10841084 _this.deedDiv
10851085 );
10861086
1087 - _this.moreDetailsDiv = $j('<div class="mwe-more-details"></div>').maskSafeHide();
 1087+ _this.moreDetailsDiv = $j('<div class="mwe-more-details"></div>');
10881088
10891089 _this.moreDetailsCtrlDiv = $j( '<div class="mwe-upwiz-details-more-options"></div>' );
10901090
@@ -2667,7 +2667,6 @@
26682668 var toggleDiv = $j('<div />');
26692669
26702670 var customDiv = $j('<div/>')
2671 - .maskSafeHide()
26722671 .append(
26732672 $j( '<input />')
26742673 .attr( { type: 'checkbox' } )
@@ -2927,6 +2926,8 @@
29282927 .click( toggle )
29292928 .data( 'open', false )
29302929 .append( icon, text ) );
 2930+
 2931+ $j( moreDiv ).maskSafeHide();
29312932
29322933 },
29332934
@@ -3104,15 +3105,28 @@
31053106 * Rather than use display: none, this collapses the divs to zero height
31063107 * This is good because then the elements in the divs still have layout and we can do things like mask and unmask (above)
31073108 * XXX may be obsolete as we are not really doing this any more
 3109+ * disable form fields so we do not tab through them when hidden
 3110+ * XXX for some reason the disabling doesn't work with the date field.
31083111 */
31093112
31103113 jQuery.fn.maskSafeHide = function( options ) {
 3114+ $j.each( this.find( ':enabled' ), function(i, input) {
 3115+ $j( input ).data( 'wasEnabled', true )
 3116+ .attr( 'disabled', 'disabled' );
 3117+ } );
31113118 return this.css( { 'height' : '0px', 'overflow' : 'hidden' } );
31123119 };
31133120
31143121 // XXX check overflow properties, is auto/auto not the right thing?
31153122 // may be causing scrollbar to appear when div changes size
 3123+// re-enable form fields (disabled so we did not tab through them when hidden)
31163124 jQuery.fn.maskSafeShow = function( options ) {
 3125+ $j.each( this.find( ':disabled' ), function (i, input) {
 3126+ if ($j( input ).data( 'wasEnabled' )) {
 3127+ $j( input ).removeAttr( 'disabled' )
 3128+ .removeData( 'wasEnabled' );
 3129+ }
 3130+ } );
31173131 return this.css( { 'height' : 'auto', 'overflow' : 'visible' } );
31183132 };
31193133

Status & tagging log