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

Non-jquery slider #630

Closed
jasongrout opened this issue Jun 14, 2016 · 29 comments · Fixed by #2712
Closed

Non-jquery slider #630

jasongrout opened this issue Jun 14, 2016 · 29 comments · Fixed by #2712
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. roadmap
Milestone

Comments

@jasongrout
Copy link
Member

Looking at slider options, here is a simple slider that appears to satisfy our needs: http://refreshless.com/nouislider/ (basic typescript definitions here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/nouislider/nouislider.d.ts)

@SylvainCorlay, @jdfreder, @afshin - what do you guys think of moving to use nouislider?

Another possibility is to use the browser sliders (they are pretty much standardized now, though the UI customizations vary greatly: https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/. The problem there is that we wouldn't have range sliders, which would be a regression.

@SylvainCorlay
Copy link
Member

👎 on native browser sliders because of absence of range sliders that are used a lot.

@SylvainCorlay
Copy link
Member

nouislider seems to only be about range sliders.

@SylvainCorlay
Copy link
Member

Re: the current jquery ui slider, I just wanted to communicate that there is no problem with having jquery-based widgets.
It just happens that the slider is the only core widget to make use of jquery and it is the only reason why jupyter-js-widgets depends on jquery.

@jasongrout
Copy link
Member Author

and jquery-ui...

@jasongrout
Copy link
Member Author

nouislider has range sliders, but it's not only about range sliders...

@afshin
Copy link
Contributor

afshin commented Jun 27, 2016

noUiSlider seems reasonable enough to me. I don't have any experience with it, but it doesn't seem bloated to me, which is my main concern about external libs.

It might seem silly to ask, but are we cool with WTFPL?

@jasongrout
Copy link
Member Author

I looked into the license a bit. Wikipedia has a bunch of links where the FSF acknowledges it, it seems that various people (whatever that's worth) say it is basically a public domain dedication. The license author even says you can relicense work ("The WTFPL lets you relicense the work under any other license." on http://www.wtfpl.net/faq/), so even if we're not happy with it, it seems we can change the license and maintain a fork.

@jasongrout
Copy link
Member Author

This would also probably fix #655.

@dakoop
Copy link

dakoop commented Jul 18, 2016

Apparently, new HTML specs have a "multiple" attribute for range sliders, and there is a polyfill: http://leaverou.github.io/multirange/

@SylvainCorlay
Copy link
Member

@jasongrout the one-value HTML5 sliders works well and seems to be pretty well supported across the board. I started working on this in the plane for Austin.

However this will probably require us to have a well-separated view for the range...

@gnestor
Copy link
Contributor

gnestor commented Oct 5, 2016

@SylvainCorlay Do you think it makes sense for me to try out this multirange polyfill for the native HTML slider? Another thing to consider: If we are going to replace the jQuery slider with a native one, should we not do the same for Dropdowns and Progress widgets? If so, then I think it would make sense to address the

Give the widgets a facelift. Maybe material-ui? Home spun design?

roadmap item at the same time and implement a consistent style across both native and non-native elements.

@jasongrout jasongrout added this to the Backlog milestone Nov 8, 2016
@maxnoy
Copy link
Contributor

maxnoy commented May 11, 2017

Additional option -- ion.rangeSlider. Supports both single and range slider modes. More demos from shiny.

@jasongrout
Copy link
Member Author

Just saw this announcement about changes in the jquery-ui infrastructure going forward: http://blog.jqueryui.com/2017/12/the-future-of-jquery-ui-and-jquery-mobile/

I think that's another thing in favor of finding an alternative.

@den-run-ai
Copy link
Contributor

I found few range sliders with more useful features, thanks to @vidartf for pointing to this issue:

#2249

@jasongrout
Copy link
Member Author

It might seem silly to ask, but are we cool with WTFPL?

It looks like nouislider is now licensed MIT, as of about a month ago.

@jasongrout
Copy link
Member Author

@ibdafna
Copy link
Member

ibdafna commented Jan 7, 2020

As a part of the January 2020 meeting (#2641), we discussed the alternatives listed above, in addition to building our own implementation. The main considerations were keeping the slider as simple as possible - with range slider support, and reducing dependencies such as JQuery and JQuery-UI.

Below is a brief summary of all alternatives considered, including pros and cons:

  1. Multirange slider. This is a very lightweight library which polyfills native HTML5 sliders to allow for multi-handle sliders. It was built in anticipation of the official HTML spec adding support for such multi-handle sliders, however that suggeted addition to the spec has been dropped, and as a result the Multirange library is no longer actively developed. When testing, we found some rendering artefacts on browsers like Safari.

  2. noUiSlider. A relatively lightweight, but feature-packed slider package with no dependencies. Supports everything the JQuery-UI's slider implementation has. Still actively developed and growing in populatiry. Minimalist styling also makes it appealing to us as it is relatively close to the current slider styling.

  3. ion.rangeSlider. This is probably the Ferrari of sliders - highly polished with slick graphics and full feature set which exceeds the current slider functionality. However, it is quite heavy and depends on JQuery, which we are looking to move away from in the future. Although visually appealing, we found the styling quite far from the minimalist visuals we are looking for.

  4. rangeslider.js. Another HTML5 polyfill which depends on JQuery. It is also lacks multi-handle functionality which makes it an unsuitable candidate to replace our current implementation.

We voted in favour of noUiSlider as it has no dependencies, and although it is quite feature-packed, we can expose only a part of the API which will keep functionality in line with what is currently available.

We also agreed that, if needed, migration from noUiSlider to any custom implementation should be relatively simple in the future and won't require a major release.

@ibdafna
Copy link
Member

ibdafna commented Jan 7, 2020

@jasongrout
Copy link
Member Author

@ibdafna - can you list the other alternatives we considered, perhaps with a brief summary of the discussion about each?

@ibdafna
Copy link
Member

ibdafna commented Jan 8, 2020

Thanks, @jasongrout - I have added this to my comment above!

@afshin
Copy link
Contributor

afshin commented Jan 24, 2020

Does anybody have an opinion re: interact.js? It seems attractive: it supports touch events and it works on DOM nodes so it can be used within a Widget lifecycle.
https://interactjs.io/
https://www.npmjs.com/package/interactjs/v/1.8.2

@jasongrout
Copy link
Member Author

As far as I can tell, interact.js is not a slider per se, but a library unifying touch and mouse events on top of which a slider could be built. Are you asking if we've thought about building our own slider on top of something like interact.js?

@afshin
Copy link
Contributor

afshin commented Jan 25, 2020

Are you asking if we've thought about building our own slider on top of something like interact.js?

Yes. One of their examples is how you would implement a slider. It seems a bit higher level than Lumino drag drop support.

@jasongrout
Copy link
Member Author

One of their examples is how you would implement a slider.

Can you point to that example? I can't find it.

@afshin
Copy link
Contributor

afshin commented Jan 25, 2020

It's the first example on their docs page: https://interactjs.io/docs/

The code is linked to on that page, so if you just want to see the example:
https://codepen.io/taye/pen/GgpxNq

@afshin
Copy link
Contributor

afshin commented Jan 25, 2020

Screen Shot 2020-01-25 at 13 17 20

@afshin
Copy link
Contributor

afshin commented Jan 25, 2020

Ah I didn't realize @ibdafna was so far along in his slider PR.

@jasongrout
Copy link
Member Author

Interesting. That demo has a max slider value of 0.87 for me (Firefox, macOS), which seems odd.

Yes, we're working on getting @ibdafna's nouislider implementation in, which is what we decided on at the widgets sprint. Thanks for pointing out an alternative, though!

@afshin
Copy link
Contributor

afshin commented Jan 25, 2020

Oh interesting, it must be a bug. It has that same behavior for me in both Firefox and Chrome.

@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
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. roadmap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants