You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import ipywidgets as widgets
from ipywidgets import Label, HTML, HBox, Image, VBox, Box, HBox, Textarea, Layout
from ipyevents import Event
from IPython.display import display
c = ""
for i in range(100):
c += "%daaaaaaaaaaaaaaaaaaaaa\n" % i
text =Textarea(c, layout=Layout(height='200px', width='200px'))
h = HTML('Event info')
d = Event(source=text, watched_events=['wheel'], prevent_default_action=False)
def handle_event_default_demo(event):
lines = ['{}: {}'.format(k, v) for k, v in event.items()]
content = ' '.join(lines)
h.value = content
d.on_dom_event(handle_event_default_demo)
display(text, h)
I tested above code, the default wheel action does not work. The textarea scroll does not move.
I want to know scroll movement of textarea.
The text was updated successfully, but these errors were encountered:
if ((event.type == 'wheel') || this.get('prevent_default_action')) {
// Really want both of these, one to stop any default action
// and the other to ensure no other listeners pick it up.
event.preventDefault()
event.stopPropagation()
}
Sorry for the long delay -- if I remember right, the wheel event is not propagated to make sure that the notebook itself does not scroll. In this specific case -- a scrollable TextArea in a notebook -- I think allowing propagation would be fine because I suspect that the TextArea itself stops further propagation.
Is there another event you could monitor besides wheel, or make observe for a change in value of the TextArea? I can take a look next week at which widgets are themselves scrollable to try to avoid this issue for those widgets.
I tested above code, the default wheel action does not work. The textarea scroll does not move.
I want to know scroll movement of textarea.
The text was updated successfully, but these errors were encountered: