harvesthq / chosen

Deprecated - Chosen is a library for making long, unwieldy select boxes more friendly.
http://harvesthq.github.io/chosen/
Other
21.85k stars 4.1k forks source link

Unable to preventDefault inside passive event listener invocation. #3143

Open applibs opened 1 year ago

applibs commented 1 year ago

Anybody has same problem?

Unable to preventDefault inside passive event listener invocation.

Snímek obrazovky 2023-11-09 164039

applibs commented 1 year ago

This is my fix:

Chosen.prototype.search_results_mousewheel = function (evt) {
            var delta;
            if (evt.originalEvent) {
                delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
            }
            if (delta != null) {
                if (evt.cancelable) {
                    evt.preventDefault();
                }
                //evt.preventDefault();
                if (evt.type === 'DOMMouseScroll') {
                    delta = delta * 40;
                }
                return this.search_results.scrollTop(delta + this.search_results.scrollTop());
            }
        };