Yeah… I’m falling to the following function:
def disable_scroll_increment(component):
def _disable_scroll(e):
e.preventDefault()
def disable_scroll(**event_args):
focused_component = event_args['sender']
if focused_component.type == 'number':
node = js.get_dom_node(focused_component)
node.addEventListener('wheel',_disable_scroll)
def enable_scroll(**event_args):
blurred_component = event_args['sender']
if blurred_component.type == 'number':
node = js.get_dom_node(blurred_component)
node.removeEventListener('wheel', _disable_scroll)
component.add_event_handler('focus', disable_scroll)
component.add_event_handler('lost_focus', enable_scroll)
class Form1(Form1Template):
def __init__(self, **properties):
self.init_components(**properties)
# Add event listeners to disable mousewheel on number input fields
disable_scroll_increment(self.text_box_1)
That I’ll import and apply as needed.