We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d26304 commit 684f78eCopy full SHA for 684f78e
lib/web/mage/collapsible.js
@@ -448,7 +448,9 @@ define([
448
if (this.options.animate) {
449
this._animate(showProps);
450
} else {
451
- this.content.get(0).parentElement.scrollIntoView();
+ if (this._isElementOutOfViewport(this.content.get(0).parentElement)) {
452
+ this.content.get(0).parentElement.scrollIntoView();
453
+ }
454
this.content.show();
455
}
456
this._open();
@@ -554,6 +556,14 @@ define([
554
556
}, 1);
555
557
});
558
559
+ },
560
+
561
+ /**
562
+ * @private
563
+ */
564
+ _isElementOutOfViewport: function (el) {
565
+ var rect = el.getBoundingClientRect();
566
+ return rect.bottom < 0 || rect.right < 0 || rect.left > window.innerWidth || rect.top > window.innerHeight;
567
568
569
0 commit comments