mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
Dropdown: use a better selector to avoid triggering click if button is disabled (#35866)
This commit is contained in:
parent
353ad45b4b
commit
cb8726d9e7
@ -49,7 +49,7 @@ const CLASS_NAME_DROPUP = 'dropup'
|
|||||||
const CLASS_NAME_DROPEND = 'dropend'
|
const CLASS_NAME_DROPEND = 'dropend'
|
||||||
const CLASS_NAME_DROPSTART = 'dropstart'
|
const CLASS_NAME_DROPSTART = 'dropstart'
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]'
|
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'
|
||||||
const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`
|
const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`
|
||||||
const SELECTOR_MENU = '.dropdown-menu'
|
const SELECTOR_MENU = '.dropdown-menu'
|
||||||
const SELECTOR_NAVBAR = '.navbar'
|
const SELECTOR_NAVBAR = '.navbar'
|
||||||
@ -407,10 +407,6 @@ class Dropdown extends BaseComponent {
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
if (isDisabled(this)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, delegateTarget.parentNode)
|
const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, delegateTarget.parentNode)
|
||||||
const instance = Dropdown.getOrCreateInstance(getToggleButton)
|
const instance = Dropdown.getOrCreateInstance(getToggleButton)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user