From a404ac33bb9e78323b84d0840735445579634b9e Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 16 May 2012 19:09:57 -0700 Subject: [PATCH 1/5] modal accessibility tab control --- docs/assets/js/bootstrap-modal.js | 157 +++++++++++++---------- docs/assets/js/bootstrap.js | 157 +++++++++++++---------- docs/assets/js/bootstrap.min.js | 2 +- docs/javascript.html | 8 +- docs/templates/pages/javascript.mustache | 8 +- js/bootstrap-modal.js | 157 +++++++++++++---------- 6 files changed, 273 insertions(+), 216 deletions(-) diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js index c831de6b64..f7ae39652b 100644 --- a/docs/assets/js/bootstrap-modal.js +++ b/docs/assets/js/bootstrap-modal.js @@ -52,8 +52,9 @@ this.isShown = true - escape.call(this) - backdrop.call(this, function () { + this.escape() + + this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { @@ -69,6 +70,8 @@ that.$element.addClass('in') + that.enforceFocus() + transition ? that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : that.$element.trigger('shown') @@ -91,90 +94,102 @@ $('body').removeClass('modal-open') - escape.call(this) + this.escape() + this.relaxFocus() this.$element.removeClass('in') $.support.transition && this.$element.hasClass('fade') ? - hideWithTransition.call(this) : - hideModal.call(this) + this.hideWithTransition() : + this.hideModal() } - } - - - /* MODAL PRIVATE METHODS - * ===================== */ - - function hideWithTransition() { - var that = this - , timeout = setTimeout(function () { - that.$element.off($.support.transition.end) - hideModal.call(that) - }, 500) - - this.$element.one($.support.transition.end, function () { - clearTimeout(timeout) - hideModal.call(that) - }) - } - - function hideModal(that) { - this.$element - .hide() - .trigger('hidden') - - backdrop.call(this) - } - - function backdrop(callback) { - var that = this - , animate = this.$element.hasClass('fade') ? 'fade' : '' - - if (this.isShown && this.options.backdrop) { - var doAnimate = $.support.transition && animate - - this.$backdrop = $('