alexanoid
alexanoid

Reputation: 25790

Vaadin23 IntegerField disable value change on mouse scroll button

Is it possible to disable the value change effect on the mouse scroll for the IntegerField component? If so, could you please show me how it is possible?

Upvotes: 0

Views: 142

Answers (1)

Leif Åstrand
Leif Åstrand

Reputation: 8001

The scrolling behaviour comes from the browser and there isn't any direct feature for disabling it. It's still possible to do it with the workaround of listening to client-side scroll events on the element and preventing the default behaviour.

numberField.getElement().executeJs("this.focusElement.addEventListener('mousewheel', function(e) { e.preventDefault(); })");

Upvotes: 3

Related Questions