aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorJeremy Jackson <[email protected]>2019-10-17 15:01:44 +0000
committerXhmikosR <[email protected]>2019-10-17 18:01:44 +0300
commitc1ee395f80c05de8317588b07f34a65c5b95c42c (patch)
tree56d88e6e3e4256ceeea5766af744679e763eb904 /js/src
parent104385c508a4c77761b04a9842e978bab6f359f6 (diff)
downloadbootstrap-c1ee395f80c05de8317588b07f34a65c5b95c42c.tar.xz
bootstrap-c1ee395f80c05de8317588b07f34a65c5b95c42c.zip
Skip hidden dropdowns while focusing (#29523)
Diffstat (limited to 'js/src')
-rw-r--r--js/src/dropdown.js2
-rw-r--r--js/src/util/index.js9
2 files changed, 8 insertions, 3 deletions
diff --git a/js/src/dropdown.js b/js/src/dropdown.js
index 06a271ef8..4504d61e0 100644
--- a/js/src/dropdown.js
+++ b/js/src/dropdown.js
@@ -9,6 +9,7 @@ import {
getjQuery,
getElementFromSelector,
isElement,
+ isVisible,
makeArray,
noop,
typeCheckConfig
@@ -478,6 +479,7 @@ class Dropdown {
}
const items = makeArray(SelectorEngine.find(Selector.VISIBLE_ITEMS, parent))
+ .filter(isVisible)
if (!items.length) {
return
diff --git a/js/src/util/index.js b/js/src/util/index.js
index 150b4f877..8a5ae2156 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -138,9 +138,12 @@ const isVisible = element => {
}
if (element.style && element.parentNode && element.parentNode.style) {
- return element.style.display !== 'none' &&
- element.parentNode.style.display !== 'none' &&
- element.style.visibility !== 'hidden'
+ const elementStyle = getComputedStyle(element)
+ const parentNodeStyle = getComputedStyle(element.parentNode)
+
+ return elementStyle.display !== 'none' &&
+ parentNodeStyle.display !== 'none' &&
+ elementStyle.visibility !== 'hidden'
}
return false