diff --git a/assets/javascripts/bootstrap.js b/assets/javascripts/bootstrap.js index eac0ba4b..5553c128 100644 --- a/assets/javascripts/bootstrap.js +++ b/assets/javascripts/bootstrap.js @@ -368,7 +368,7 @@ e.preventDefault() }) .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { - $(e.target).closest('.btn').toggleClass('focus', e.type == 'focus') + $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) }) }(jQuery); @@ -417,6 +417,7 @@ } Carousel.prototype.keydown = function (e) { + if (/input|textarea/i.test(e.target.tagName)) return switch (e.which) { case 37: this.prev(); break case 39: this.next(); break @@ -882,7 +883,7 @@ } Dropdown.prototype.keydown = function (e) { - if (!/(38|40|27|32)/.test(e.which)) return + if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return var $this = $(this) @@ -1435,10 +1436,11 @@ this.isShown = true this.checkScrollbar() + this.setScrollbar() this.$body.addClass('modal-open') - this.setScrollbar() this.escape() + this.resize() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) @@ -1453,6 +1455,9 @@ .show() .scrollTop(0) + if (that.options.backdrop) that.adjustBackdrop() + that.adjustDialog() + if (transition) { that.$element[0].offsetWidth // force reflow } @@ -1487,6 +1492,7 @@ this.isShown = false this.escape() + this.resize() $(document).off('focusin.bs.modal') @@ -1522,11 +1528,20 @@ } } + Modal.prototype.resize = function () { + if (this.isShown) { + $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) + } else { + $(window).off('resize.bs.modal') + } + } + Modal.prototype.hideModal = function () { var that = this this.$element.hide() this.backdrop(function () { that.$body.removeClass('modal-open') + that.resetAdjustments() that.resetScrollbar() that.$element.trigger('hidden.bs.modal') }) @@ -1583,13 +1598,43 @@ } } + // these following methods are used to handle overflowing modals + + Modal.prototype.handleUpdate = function () { + if (this.options.backdrop) this.adjustBackdrop() + this.adjustDialog() + } + + Modal.prototype.adjustBackdrop = function () { + this.$backdrop + .css('height', 0) + .css('height', this.$element[0].scrollHeight) + } + + Modal.prototype.adjustDialog = function () { + var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight + + this.$element.css({ + paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', + paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' + }) + } + + Modal.prototype.resetAdjustments = function () { + this.$element.css({ + paddingLeft: '', + paddingRight: '' + }) + } + Modal.prototype.checkScrollbar = function () { + this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight this.scrollbarWidth = this.measureScrollbar() } Modal.prototype.setScrollbar = function () { var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) - if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) + if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) } Modal.prototype.resetScrollbar = function () { @@ -1597,7 +1642,6 @@ } Modal.prototype.measureScrollbar = function () { // thx walsh - if (document.body.clientWidth >= window.innerWidth) return 0 var scrollDiv = document.createElement('div') scrollDiv.className = 'modal-scrollbar-measure' this.$body.append(scrollDiv) diff --git a/assets/javascripts/bootstrap/button.js b/assets/javascripts/bootstrap/button.js index 2be02341..40382949 100644 --- a/assets/javascripts/bootstrap/button.js +++ b/assets/javascripts/bootstrap/button.js @@ -110,7 +110,7 @@ e.preventDefault() }) .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { - $(e.target).closest('.btn').toggleClass('focus', e.type == 'focus') + $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) }) }(jQuery); diff --git a/assets/javascripts/bootstrap/carousel.js b/assets/javascripts/bootstrap/carousel.js index 4e4e4779..82106d27 100644 --- a/assets/javascripts/bootstrap/carousel.js +++ b/assets/javascripts/bootstrap/carousel.js @@ -42,6 +42,7 @@ } Carousel.prototype.keydown = function (e) { + if (/input|textarea/i.test(e.target.tagName)) return switch (e.which) { case 37: this.prev(); break case 39: this.next(); break diff --git a/assets/javascripts/bootstrap/dropdown.js b/assets/javascripts/bootstrap/dropdown.js index ae192e57..64ec34d5 100644 --- a/assets/javascripts/bootstrap/dropdown.js +++ b/assets/javascripts/bootstrap/dropdown.js @@ -55,7 +55,7 @@ } Dropdown.prototype.keydown = function (e) { - if (!/(38|40|27|32)/.test(e.which)) return + if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return var $this = $(this) diff --git a/assets/javascripts/bootstrap/modal.js b/assets/javascripts/bootstrap/modal.js index 8b0e269b..ed3f0293 100644 --- a/assets/javascripts/bootstrap/modal.js +++ b/assets/javascripts/bootstrap/modal.js @@ -56,10 +56,11 @@ this.isShown = true this.checkScrollbar() + this.setScrollbar() this.$body.addClass('modal-open') - this.setScrollbar() this.escape() + this.resize() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) @@ -74,6 +75,9 @@ .show() .scrollTop(0) + if (that.options.backdrop) that.adjustBackdrop() + that.adjustDialog() + if (transition) { that.$element[0].offsetWidth // force reflow } @@ -108,6 +112,7 @@ this.isShown = false this.escape() + this.resize() $(document).off('focusin.bs.modal') @@ -143,11 +148,20 @@ } } + Modal.prototype.resize = function () { + if (this.isShown) { + $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) + } else { + $(window).off('resize.bs.modal') + } + } + Modal.prototype.hideModal = function () { var that = this this.$element.hide() this.backdrop(function () { that.$body.removeClass('modal-open') + that.resetAdjustments() that.resetScrollbar() that.$element.trigger('hidden.bs.modal') }) @@ -204,13 +218,43 @@ } } + // these following methods are used to handle overflowing modals + + Modal.prototype.handleUpdate = function () { + if (this.options.backdrop) this.adjustBackdrop() + this.adjustDialog() + } + + Modal.prototype.adjustBackdrop = function () { + this.$backdrop + .css('height', 0) + .css('height', this.$element[0].scrollHeight) + } + + Modal.prototype.adjustDialog = function () { + var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight + + this.$element.css({ + paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', + paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' + }) + } + + Modal.prototype.resetAdjustments = function () { + this.$element.css({ + paddingLeft: '', + paddingRight: '' + }) + } + Modal.prototype.checkScrollbar = function () { + this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight this.scrollbarWidth = this.measureScrollbar() } Modal.prototype.setScrollbar = function () { var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) - if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) + if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) } Modal.prototype.resetScrollbar = function () { @@ -218,7 +262,6 @@ } Modal.prototype.measureScrollbar = function () { // thx walsh - if (document.body.clientWidth >= window.innerWidth) return 0 var scrollDiv = document.createElement('div') scrollDiv.className = 'modal-scrollbar-measure' this.$body.append(scrollDiv) diff --git a/assets/stylesheets/bootstrap/_badges.scss b/assets/stylesheets/bootstrap/_badges.scss index 02394ae7..c913f144 100644 --- a/assets/stylesheets/bootstrap/_badges.scss +++ b/assets/stylesheets/bootstrap/_badges.scss @@ -36,11 +36,17 @@ // [converter] extracted a& to a.badge // Account for badges in navs - a.list-group-item.active > &, + .list-group-item.active > &, .nav-pills > .active > a > & { color: $badge-active-color; background-color: $badge-active-bg; } + .list-group-item > & { + float: right; + } + .list-group-item > & + & { + margin-right: 5px; + } .nav-pills > li > a > & { margin-left: 3px; } diff --git a/assets/stylesheets/bootstrap/_button-groups.scss b/assets/stylesheets/bootstrap/_button-groups.scss index 9bfa085b..e761daaf 100644 --- a/assets/stylesheets/bootstrap/_button-groups.scss +++ b/assets/stylesheets/bootstrap/_button-groups.scss @@ -18,10 +18,6 @@ &.active { z-index: 2; } - &:focus { - // Remove focus outline when dropdown JS adds it after closing the menu - outline: 0; - } } } diff --git a/assets/stylesheets/bootstrap/_forms.scss b/assets/stylesheets/bootstrap/_forms.scss index 4e694b3e..439657c0 100644 --- a/assets/stylesheets/bootstrap/_forms.scss +++ b/assets/stylesheets/bootstrap/_forms.scss @@ -170,41 +170,28 @@ input[type="search"] { // Special styles for iOS temporal inputs // // In Mobile Safari, setting `display: block` on temporal inputs causes the -// text within the input to become vertically misaligned. -// As a workaround, we set a pixel line-height that matches the -// given height of the input. Since this fucks up everything else, we have to -// appropriately reset it for Internet Explorer and the size variations. +// text within the input to become vertically misaligned. As a workaround, we +// set a pixel line-height that matches the given height of the input, but only +// for Safari. -input[type="date"], -input[type="time"], -input[type="datetime-local"], -input[type="month"] { - line-height: $input-height-base; - // IE8+ misaligns the text within date inputs, so we reset - line-height: $line-height-base #{\0}; - - &.input-sm { +@media screen and (-webkit-min-device-pixel-ratio: 0) { + input[type="date"], + input[type="time"], + input[type="datetime-local"], + input[type="month"] { + line-height: $input-height-base; + } + input[type="date"].input-sm, + input[type="time"].input-sm, + input[type="datetime-local"].input-sm, + input[type="month"].input-sm { line-height: $input-height-small; - line-height: $line-height-small #{\0}; } - &.input-lg { + input[type="date"].input-lg, + input[type="time"].input-lg, + input[type="datetime-local"].input-lg, + input[type="month"].input-lg { line-height: $input-height-large; - line-height: $line-height-large #{\0}; - } -} - -// IE 11 hack to reverse the iOS temporal input hack. -_:-ms-fullscreen, :root input[type="date"], -_:-ms-fullscreen, :root input[type="time"], -_:-ms-fullscreen, :root input[type="datetime-local"], -_:-ms-fullscreen, :root input[type="month"] { - line-height: $line-height-base; - - &.input-sm { - line-height: $line-height-small; - } - &.input-lg { - line-height: $line-height-large; } } diff --git a/assets/stylesheets/bootstrap/_jumbotron.scss b/assets/stylesheets/bootstrap/_jumbotron.scss index f3862132..ed4c6c99 100644 --- a/assets/stylesheets/bootstrap/_jumbotron.scss +++ b/assets/stylesheets/bootstrap/_jumbotron.scss @@ -35,7 +35,8 @@ @media screen and (min-width: $screen-sm-min) { padding: ($jumbotron-padding * 1.6) 0; - .container & { + .container &, + .container-fluid & { padding-left: ($jumbotron-padding * 2); padding-right: ($jumbotron-padding * 2); } diff --git a/assets/stylesheets/bootstrap/_list-group.scss b/assets/stylesheets/bootstrap/_list-group.scss index 14912b18..26b23ff8 100644 --- a/assets/stylesheets/bootstrap/_list-group.scss +++ b/assets/stylesheets/bootstrap/_list-group.scss @@ -35,14 +35,6 @@ margin-bottom: 0; @include border-bottom-radius($list-group-border-radius); } - - // Align badges within list items - > .badge { - float: right; - } - > .badge + .badge { - margin-right: 5px; - } } diff --git a/assets/stylesheets/bootstrap/_modals.scss b/assets/stylesheets/bootstrap/_modals.scss index fea4f361..2fd097ca 100644 --- a/assets/stylesheets/bootstrap/_modals.scss +++ b/assets/stylesheets/bootstrap/_modals.scss @@ -62,10 +62,9 @@ // Modal background .modal-backdrop { - position: fixed; + position: absolute; top: 0; right: 0; - bottom: 0; left: 0; background-color: $modal-backdrop-bg; // Fade for backdrop diff --git a/assets/stylesheets/bootstrap/_navbar.scss b/assets/stylesheets/bootstrap/_navbar.scss index 8737ad3f..73b8587b 100644 --- a/assets/stylesheets/bootstrap/_navbar.scss +++ b/assets/stylesheets/bootstrap/_navbar.scss @@ -331,6 +331,7 @@ } // Menu position and menu caret support for dropups via extra dropup class .navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { + @include border-top-radius($navbar-border-radius); @include border-bottom-radius(0); } diff --git a/assets/stylesheets/bootstrap/_popovers.scss b/assets/stylesheets/bootstrap/_popovers.scss index 9e28c3c5..46c45f50 100644 --- a/assets/stylesheets/bootstrap/_popovers.scss +++ b/assets/stylesheets/bootstrap/_popovers.scss @@ -12,6 +12,7 @@ max-width: $popover-max-width; padding: 1px; // Reset font and text propertes given new insertion method + font-family: $font-family-base; font-size: $font-size-base; font-weight: normal; line-height: $line-height-base; diff --git a/assets/stylesheets/bootstrap/_theme.scss b/assets/stylesheets/bootstrap/_theme.scss index 05eb32ab..51534fe7 100644 --- a/assets/stylesheets/bootstrap/_theme.scss +++ b/assets/stylesheets/bootstrap/_theme.scss @@ -151,6 +151,18 @@ border-radius: 0; } +// Fix active state of dropdown items in collapsed mode +@media (max-width: $grid-float-breakpoint-max) { + .navbar .navbar-nav .open .dropdown-menu > .active > a { + &, + &:hover, + &:focus { + color: #fff; + @include gradient-vertical($start-color: $dropdown-link-active-bg, $end-color: darken($dropdown-link-active-bg, 5%)); + } + } +} + // // Alerts diff --git a/assets/stylesheets/bootstrap/_tooltip.scss b/assets/stylesheets/bootstrap/_tooltip.scss index dec674cb..c6e43287 100644 --- a/assets/stylesheets/bootstrap/_tooltip.scss +++ b/assets/stylesheets/bootstrap/_tooltip.scss @@ -9,7 +9,10 @@ z-index: $zindex-tooltip; display: block; visibility: visible; + // Reset font and text propertes given new insertion method + font-family: $font-family-base; font-size: $font-size-small; + font-weight: normal; line-height: 1.4; @include opacity(0); @@ -39,6 +42,7 @@ border-color: transparent; border-style: solid; } +// Note: Deprecated .top-left, .top-right, .bottom-left, and .bottom-right as of v3.3.1 .tooltip { &.top .tooltip-arrow { bottom: 0; @@ -49,13 +53,15 @@ } &.top-left .tooltip-arrow { bottom: 0; - left: $tooltip-arrow-width; + right: $tooltip-arrow-width; + margin-bottom: -$tooltip-arrow-width; border-width: $tooltip-arrow-width $tooltip-arrow-width 0; border-top-color: $tooltip-arrow-color; } &.top-right .tooltip-arrow { bottom: 0; - right: $tooltip-arrow-width; + left: $tooltip-arrow-width; + margin-bottom: -$tooltip-arrow-width; border-width: $tooltip-arrow-width $tooltip-arrow-width 0; border-top-color: $tooltip-arrow-color; } @@ -82,13 +88,15 @@ } &.bottom-left .tooltip-arrow { top: 0; - left: $tooltip-arrow-width; + right: $tooltip-arrow-width; + margin-top: -$tooltip-arrow-width; border-width: 0 $tooltip-arrow-width $tooltip-arrow-width; border-bottom-color: $tooltip-arrow-color; } &.bottom-right .tooltip-arrow { top: 0; - right: $tooltip-arrow-width; + left: $tooltip-arrow-width; + margin-top: -$tooltip-arrow-width; border-width: 0 $tooltip-arrow-width $tooltip-arrow-width; border-bottom-color: $tooltip-arrow-color; } diff --git a/assets/stylesheets/bootstrap/_variables.scss b/assets/stylesheets/bootstrap/_variables.scss index b4fba439..7d190f26 100644 --- a/assets/stylesheets/bootstrap/_variables.scss +++ b/assets/stylesheets/bootstrap/_variables.scss @@ -19,7 +19,7 @@ $gray: lighten($gray-base, 33.5%) !default; // #555 $gray-light: lighten($gray-base, 46.7%) !default; // #777 $gray-lighter: lighten($gray-base, 93.5%) !default; // #eee -$brand-primary: #428bca !default; +$brand-primary: darken(#428bca, 6.5%) !default; $brand-success: #5cb85c !default; $brand-info: #5bc0de !default; $brand-warning: #f0ad4e !default; diff --git a/lib/bootstrap-sass/version.rb b/lib/bootstrap-sass/version.rb index aa516cd5..dee95ef2 100644 --- a/lib/bootstrap-sass/version.rb +++ b/lib/bootstrap-sass/version.rb @@ -1,4 +1,4 @@ module Bootstrap VERSION = '3.3.0.1' - BOOTSTRAP_SHA = '16dbdbd7a2c6cfa3be4e5dcc52249e577c02c84a' + BOOTSTRAP_SHA = '07c1881bc27eacba74f4d975ca3428a24abd4940' end diff --git a/templates/project/_bootstrap-variables.sass b/templates/project/_bootstrap-variables.sass index 48f2eec7..54df5887 100644 --- a/templates/project/_bootstrap-variables.sass +++ b/templates/project/_bootstrap-variables.sass @@ -21,7 +21,7 @@ // $gray-light: lighten($gray-base, 46.7%) // #777 // $gray-lighter: lighten($gray-base, 93.5%) // #eee -// $brand-primary: #428bca +// $brand-primary: darken(#428bca, 6.5%) // $brand-success: #5cb85c // $brand-info: #5bc0de // $brand-warning: #f0ad4e