Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/src/util
diff options
context:
space:
mode:
authorRyan Berliner <22206986+RyanBerliner@users.noreply.github.com>2022-01-13 11:55:05 +0300
committerGitHub <noreply@github.com>2022-01-13 11:55:05 +0300
commit14c7dc1e886015f2ed845f0f8e88d3597694250f (patch)
tree86b1432f333f304c3ead0706fdfd6a01c8f9ecd2 /js/src/util
parentd581737f784d144a961d61248d42f59440159571 (diff)
Fix: `isVisible` function behavior in case of a `<details>` element, on chrome 97 (#35682)
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/index.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/js/src/util/index.js b/js/src/util/index.js
index 8bd614d40c..4e52fd3eb0 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -128,7 +128,26 @@ const isVisible = element => {
return false
}
- return getComputedStyle(element).getPropertyValue('visibility') === 'visible'
+ const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'
+ // Handle `details` element as its content may falsie appear visible when it is closed
+ const closedDetails = element.closest('details:not([open])')
+
+ if (!closedDetails) {
+ return elementIsVisible
+ }
+
+ if (closedDetails !== element) {
+ const summary = element.closest('summary')
+ if (summary && summary.parentNode !== closedDetails) {
+ return false
+ }
+
+ if (summary === null) {
+ return false
+ }
+ }
+
+ return elementIsVisible
}
const isDisabled = element => {