Skip to content

Commit 2f13c44

Browse files
committed
MAGETWO-91504: Mobile PDP accordion widget hides accordion content on phones with iOS
- fix js static
1 parent 64fffdf commit 2f13c44

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/web/mage/collapsible.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,7 @@ define([
448448
if (this.options.animate) {
449449
this._animate(showProps);
450450
} else {
451-
if (this._isElementOutOfViewport(this.content.get(0).parentElement)) {
452-
this.content.get(0).parentElement.scrollIntoView();
453-
}
451+
this._scrollToTopIfVisible(this.content.get(0).parentElement);
454452
this.content.show();
455453
}
456454
this._open();
@@ -562,8 +560,20 @@ define([
562560
* @param {HTMLElement} elem
563561
* @private
564562
*/
563+
_scrollToTopIfVisible: function (elem) {
564+
if (this._isElementOutOfViewport(elem)) {
565+
elem.scrollIntoView();
566+
}
567+
},
568+
569+
/**
570+
* @param {HTMLElement} elem
571+
* @private
572+
* @return {Boolean}
573+
*/
565574
_isElementOutOfViewport: function (elem) {
566575
var rect = elem.getBoundingClientRect();
576+
567577
return rect.bottom < 0 || rect.right < 0 || rect.left > window.innerWidth || rect.top > window.innerHeight;
568578
}
569579
});

0 commit comments

Comments
 (0)