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

Fix slider change event issue with tapping #3617

Merged
merged 4 commits into from
Dec 13, 2022

Conversation

ibdafna
Copy link
Member

@ibdafna ibdafna commented Oct 21, 2022

Signed-off-by: Itay Dafna i.b.dafna@gmail.com

Addresses #3597

Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch ibdafna/ipywidgets/fix_slider

@jasongrout
Copy link
Member

@ibdafna - it does look like the linting test doesn't pass, so we do need to run the lint on these changes.

Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Copy link
Member

@vidartf vidartf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes themselves look good, but I would maybe want you to do an extra pass on the docstrings? Some of them don't match anymore, some are missing, and some could be made more precise (e.g. the update event happens for more than just the slide event, but it is maybe the most common case, and the change event happens for more than just mouse up).

Copy link
Member

@vidartf vidartf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but a comment for consideration either in this PR or for future issues.

const actual_value = Math.pow(base, this._validate_slide_value(values[0]));
this.readout.textContent = this.valueToString(actual_value);

this.handleSliderChanged(values, handle);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess one problem that can occur is that when you tap or move by the arrow keys, you will get two events: one from the update event, and one from the change event. If we wanted to avoid this, we could conditionally only pass the event on if continuous_update is false here (and other similar event handlers). I'm just not sure how bad of an issue this duplicate is, and if it can lead to some issues with multiple users, or if backbone will automatically discard the second change as a no-op.

@ceriottm
Copy link

ceriottm commented Dec 6, 2022

Just to confirm that this fixes #3597 also in our setting. Awesome. It'd be great to have this merged in the near future, as we need this to deploy an interactive course that relies heavily on sliders.

@jasongrout jasongrout merged commit 10dca83 into jupyter-widgets:master Dec 13, 2022
@maartenbreddels
Copy link
Member

This PR is released in ipywidgets 8.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants