aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorDirk Ginader <[email protected]>2012-08-01 20:11:16 -0700
committerDirk Ginader <[email protected]>2012-08-01 20:11:16 -0700
commit6977d35eedd8a0b25b7b18eae67c3299eb18badd (patch)
tree8d00a3332a800c4e747a46fd313183b5e198963d /js
parentc2e899f2a014e18f9cf981ea89a20e18a5c9fefb (diff)
downloadbootstrap-6977d35eedd8a0b25b7b18eae67c3299eb18badd.tar.xz
bootstrap-6977d35eedd8a0b25b7b18eae67c3299eb18badd.zip
close #3531 added focus handling and removed the badly announced "times" close button from screenreaders
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-modal.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index 530b53e07..a6fe1e817 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -69,7 +69,10 @@
that.$element[0].offsetWidth // force reflow
}
- that.$element.addClass('in')
+ that.$element
+ .addClass('in')
+ .attr('aria-hidden', false)
+ .focus()
that.enforceFocus()
@@ -99,7 +102,9 @@
$(document).off('focusin.modal')
- this.$element.removeClass('in')
+ this.$element
+ .removeClass('in')
+ .attr('aria-hidden', true)
$.support.transition && this.$element.hasClass('fade') ?
this.hideWithTransition() :
@@ -118,11 +123,11 @@
, escape: function () {
var that = this
if (this.isShown && this.options.keyboard) {
- $(document).on('keyup.dismiss.modal', function ( e ) {
+ this.$element.on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
- $(document).off('keyup.dismiss.modal')
+ this.$element.off('keyup.dismiss.modal')
}
}
@@ -222,7 +227,12 @@
, option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
e.preventDefault()
- $target.modal(option)
+
+ $target
+ .modal(option)
+ .one('hide', function () {
+ $this.focus()
+ })
})
})