Skip to content

Commit ef97595

Browse files
committed
fix: detect visibility:hidden in addition to display:none for hidden state
1 parent 0c2c3dd commit ef97595

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

dist/filepond.esm.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ const updateRect = (rect = {}, element = {}, style = {}) => {
833833

834834
rect.scrollTop = element.scrollTop;
835835

836-
rect.hidden = element.offsetParent === null;
836+
rect.hidden = element.offsetParent === null || style.visibility === 'hidden';
837837

838838
return rect;
839839
};
@@ -8734,7 +8734,11 @@ const createApp = (initialOptions = {}) => {
87348734

87358735
if (isHidden && isResting) {
87368736
// test if is no longer hidden
8737-
isResting = view.element.offsetParent === null;
8737+
// check both display:none (offsetParent) and visibility:hidden
8738+
const el = view.element;
8739+
const isStillHidden =
8740+
el.offsetParent === null || getComputedStyle(el).visibility === 'hidden';
8741+
isResting = isStillHidden;
87388742
}
87398743

87408744
// if resting, no need to read as numbers will still all be correct

dist/filepond.esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/filepond.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@
950950

951951
rect.scrollTop = element.scrollTop;
952952

953-
rect.hidden = element.offsetParent === null;
953+
rect.hidden = element.offsetParent === null || style.visibility === 'hidden';
954954

955955
return rect;
956956
};
@@ -11605,7 +11605,11 @@
1160511605

1160611606
if (isHidden && isResting) {
1160711607
// test if is no longer hidden
11608-
isResting = view.element.offsetParent === null;
11608+
// check both display:none (offsetParent) and visibility:hidden
11609+
var el = view.element;
11610+
var isStillHidden =
11611+
el.offsetParent === null || getComputedStyle(el).visibility === 'hidden';
11612+
isResting = isStillHidden;
1160911613
}
1161011614

1161111615
// if resting, no need to read as numbers will still all be correct

dist/filepond.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/app/frame/utils/updateRect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const updateRect = (rect = {}, element = {}, style = {}) => {
1919

2020
rect.scrollTop = element.scrollTop;
2121

22-
rect.hidden = element.offsetParent === null;
22+
rect.hidden = element.offsetParent === null || style.visibility === 'hidden';
2323

2424
return rect;
2525
};

src/js/app/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ export const createApp = (initialOptions = {}) => {
112112

113113
if (isHidden && isResting) {
114114
// test if is no longer hidden
115-
isResting = view.element.offsetParent === null;
115+
// check both display:none (offsetParent) and visibility:hidden
116+
const el = view.element;
117+
const isStillHidden = el.offsetParent === null ||
118+
getComputedStyle(el).visibility === 'hidden';
119+
isResting = isStillHidden;
116120
}
117121

118122
// if resting, no need to read as numbers will still all be correct

0 commit comments

Comments
 (0)