Skip to content

Commit

Permalink
change tooltip/popover insert strategy
Browse files Browse the repository at this point in the history
remove modal-open class
hopefully resolve z-index headaches
  • Loading branch information
fat committed Sep 25, 2012
1 parent 4a24439 commit 88b1e44
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 49 deletions.
16 changes: 0 additions & 16 deletions docs/assets/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -4985,22 +4985,6 @@ input[type="submit"].btn.btn-mini {
background-color: #fff;
}

.modal-open .dropdown-menu {
z-index: 2050;
}

.modal-open .dropdown.open {
*z-index: 2050;
}

.modal-open .popover {
z-index: 2060;
}

.modal-open .tooltip {
z-index: 2080;
}

.modal-backdrop {
position: fixed;
top: 0;
Expand Down
4 changes: 0 additions & 4 deletions docs/assets/js/bootstrap-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@

if (this.isShown || e.isDefaultPrevented()) return

$('body').addClass('modal-open')

This comment has been minimized.

Copy link
@bryanchug

bryanchug Mar 20, 2013

Why remove this? This is kinda very useful.

This comment has been minimized.

Copy link
@bryanchug
this.isShown = true

this.escape()
Expand Down Expand Up @@ -96,8 +94,6 @@

this.isShown = false

$('body').removeClass('modal-open')

this.escape()

$(document).off('focusin.modal')
Expand Down
6 changes: 3 additions & 3 deletions docs/assets/js/bootstrap-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
$tip
.remove()
.css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body)
.insertAfter(this.$element)

This comment has been minimized.

Copy link
@ansman

ansman Nov 9, 2012

Contributor

Why was this done?

This broke stuff for me, the tooltip cannot be in the same container as this.$element.

This comment has been minimized.

Copy link
@nozpheratu

nozpheratu Nov 21, 2012

I'm with ansman on this one, tooltips don't play nicely inside of tables evidently! Check out #5768

This comment has been minimized.

Copy link
@masterkain

masterkain Nov 26, 2012

breakage!

This comment has been minimized.

Copy link
@Keytwo

Keytwo Nov 26, 2012

Such a modification will make tooltips elements to inherit styles from parents elements.
An optional flag would be better, let the developer choose whether to append to body or adopt your new strategy.

This comment has been minimized.

Copy link
@Yohn

Yohn Nov 26, 2012

Contributor

@Keytwo I submitted a pull request that allows you to do just that with a container option -- #5768 you could then do data-container="body" or with javascript .tooltip({ container: 'body' })

This comment has been minimized.

Copy link
@Keytwo

Keytwo Nov 27, 2012

@Yohn
Good to know! Thanks for your time! ;-)

This comment has been minimized.

Copy link
@matharden

matharden Dec 21, 2012

Please make this optional. My popover target was a TD, meaning the tooltip broke the DOM. I got round this by adding an element on click and using that as the target. But I still have the issue that this results, in my case, with a form element within a form element - bad juju. I think this is a good enough use case to make this a simple option.


pos = this.getPosition(inside)

Expand All @@ -144,7 +144,7 @@
}

$tip
.css(tp)
.offset(tp)
.addClass(placement)
.addClass('in')
}
Expand Down Expand Up @@ -272,4 +272,4 @@
, html: false
}

}(window.jQuery);
}(window.jQuery);
11 changes: 3 additions & 8 deletions docs/assets/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,6 @@

if (this.isShown || e.isDefaultPrevented()) return

$('body').addClass('modal-open')

this.isShown = true

this.escape()
Expand Down Expand Up @@ -820,8 +818,6 @@

this.isShown = false

$('body').removeClass('modal-open')

this.escape()

$(document).off('focusin.modal')
Expand Down Expand Up @@ -1083,7 +1079,7 @@
$tip
.remove()
.css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body)
.insertAfter(this.$element)

pos = this.getPosition(inside)

Expand All @@ -1106,7 +1102,7 @@
}

$tip
.css(tp)
.offset(tp)
.addClass(placement)
.addClass('in')
}
Expand Down Expand Up @@ -1234,8 +1230,7 @@
, html: false
}

}(window.jQuery);
/* ===========================================================
}(window.jQuery);/* ===========================================================
* bootstrap-popover.js v2.1.2
* http://twitter.github.com/bootstrap/javascript.html#popovers
* ===========================================================
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/bootstrap.min.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions js/bootstrap-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@

if (this.isShown || e.isDefaultPrevented()) return

$('body').addClass('modal-open')

this.isShown = true

this.escape()
Expand Down Expand Up @@ -96,8 +94,6 @@

this.isShown = false

$('body').removeClass('modal-open')

this.escape()

$(document).off('focusin.modal')
Expand Down
6 changes: 3 additions & 3 deletions js/bootstrap-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
$tip
.remove()
.css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body)
.insertAfter(this.$element)

pos = this.getPosition(inside)

Expand All @@ -144,7 +144,7 @@
}

$tip
.css(tp)
.offset(tp)
.addClass(placement)
.addClass('in')
}
Expand Down Expand Up @@ -272,4 +272,4 @@
, html: false
}

}(window.jQuery);
}(window.jQuery);
10 changes: 0 additions & 10 deletions less/modals.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
// Modals
// --------------------------------------------------


// Recalculate z-index where appropriate,
// but only apply to elements within modal
.modal-open {
.dropdown-menu { z-index: @zindexDropdown + @zindexModal; }
.dropdown.open { *z-index: @zindexDropdown + @zindexModal; }
.popover { z-index: @zindexPopover + @zindexModal; }
.tooltip { z-index: @zindexTooltip + @zindexModal; }
}

// Background
.modal-backdrop {
position: fixed;
Expand Down

0 comments on commit 88b1e44

Please sign in to comment.