1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-08 14:46:34 +02:00

collapse: prevent url change if A nested tag is clicked (#32438)

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
Daniele Faraglia
2020-12-21 12:37:35 +00:00
committed by GitHub
parent 2d46e47464
commit 59cd71631e
2 changed files with 24 additions and 1 deletions

View File

@@ -371,7 +371,7 @@ class Collapse extends BaseComponent {
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A') {
if (event.target.tagName === 'A' || (event.delegateTarget && event.delegateTarget.tagName === 'A')) {
event.preventDefault()
}