0

I want to disable those tab click scroll down. when clicking on any tab I don't want to scroll on its content

enter image description here

1

2 Answers 2

1

My temporary solution was changing _scrollToTopIfVisible function in this file

\lib\web\mage\collapsible.js

From

        _scrollToTopIfVisible: function (elem) {
            if (!this._isElementOutOfViewport(elem)) {
                elem.scrollIntoView();
            }
        },
to

        _scrollToTopIfVisible: function (elem) {
            if (this._isElementOutOfViewport(elem)) {
                elem.scrollIntoView();
            }
        },

If anyone has other soluation please share

Hope this helps.

1

Best way is to create a mixin to overrule the part which makes it scroll.

define([
    'jquery',
], function ($) {
    'use strict';

    return function (target) {
        $.widget('mage.collapsible', target, {
            _create: function () {
                this.storage = $.localStorage;
                this.icons = false;

                if (typeof this.options.icons === 'string') {
                    this.options.icons = JSON.parse(this.options.icons);
                }

                this._processPanels();
                this._processState();
                this._refresh();

                if (this.options.icons.header && this.options.icons.activeHeader) {
                    this._createIcons();
                    this.icons = true;
                }

                // Removed block which make scroll to top

                this._bind('click');
                this._trigger('created');
            }
        });

        return $.mage.collapsible;
    };
});

I made a feature request to make this configurable/optional. https://github.com/magento/magento2/issues/38382

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.