Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text.value not updated when pasting using mouse #1401

Closed
sbmacdonald opened this issue Jun 1, 2017 · 12 comments
Closed

Text.value not updated when pasting using mouse #1401

sbmacdonald opened this issue Jun 1, 2017 · 12 comments
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@sbmacdonald
Copy link

I have a Text widget, that will have a long uuid pasted into it. The "on_change" event is not fired if I right-click and paste the value. Below the Text widget I have a Button that relies on the value of the Text widget being set. Currently the only way to ensure the Text value is set, is for the user to press a navigation key (enter, tab, arrow), which seems to trigger the "on_change" event.

This is rather disappointing user experience, any thoughts ?

@jasongrout
Copy link
Member

What browser, version, and operating system is this on?

@sbmacdonald
Copy link
Author

sbmacdonald commented Jun 1, 2017

Chrome & Firefox on Ubuntu 14.04, ipwidgets version 6.0.0

scott@rain:~$ pip freeze | grep widget
ipywidgets==6.0.0
widgetsnbextension==2.0.0

@sbmacdonald
Copy link
Author

I am happy to generate an AWS hosted sample notebook if that helps.

I LOVE jupyter and ipywidgets!

@jasongrout
Copy link
Member

Ah, looking at the code it looks like we explicitly look for key events:

events(): {[e: string]: string} {

Perhaps we should instead listen for the input event: https://developer.mozilla.org/en-US/docs/Web/Events/input

@jasongrout jasongrout modified the milestones: 7.0, Future Jun 1, 2017
@jasongrout
Copy link
Member

Would you like to work on this? PRs are definitely welcome!

@sbmacdonald
Copy link
Author

sbmacdonald commented Jun 1, 2017

I am not a web developer, and I don't have very good understanding of web events. If It weren't for these widgets I would be lost. I am not adverse to helping out, but just not sure you want me mucking around in the code!

For me, (ideally) the value of the Text widget would be set/updated whenever focus is changed away from the Text widget. I would prefer not to have to register an observer to watch the Text value for changes. Ideally a right-click-paste, followed by a change in focus to my "run" button would be enough for the Text value to be set.

I really appreciate you having a look at this issue.

@jasongrout
Copy link
Member

I think with the input event, the change would actually happen immediately, without blurring the input.

We have two modes for the text widget - continuous updates (using keypress events) and non-continuous updates (again using keypress events, but listening for the enter key specifically). I think we should experiment with changing these two modes to using the input event and change event, respectively.

@maartenbreddels
Copy link
Member

Another option would be to attach an event handler like Button click, so by default the value is always synced, but if you only want it on blur, you'd have to attach a event handler. I think that would be more flexible.

@sbmacdonald
Copy link
Author

I guess what I'm suggesting is that mouse events should trigger the Text value to be set just like key events.

@maartenbreddels
Copy link
Member

I understand, and I agree. But at the same time we may tackle how to deal with different use cases for when you want other behaviour. Update while typeing, or only on losing focus or hitting enter.
The downside of what I suggest in my previous comment is that jslink cannot deal with events...

@sbmacdonald
Copy link
Author

sbmacdonald commented Jun 2, 2017

Sounds good. I can't say I understand the different options completely, if you think you have options to provide the additional functionality I would be happy with any solution. I recoginize this is probably considered an edge case, but it would certainly improve the usability of my notebooks, which are actually beign shared with many of our clients.

I have a visualization tool that requires users to enter a UUID, which is quite painful to type by hand, so cut-and-paste entry is typical. Currently I have to tell users to hit enter or tab before pressing the "run" button.

image

@jasongrout
Copy link
Member

This is fixed in #1545.

@jasongrout jasongrout modified the milestones: 7.0, Future Sep 5, 2017
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 10, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

3 participants