Live data from Hacker News

Select2 - A better way to make select boxes (with jQuery)

github.com

21–30 of 60 posts

Re: Select2 - A better way to make select boxes (with jQuery)

#21
post #12

While it's always good to have people exploring improvements to UI elements, it would be superior to have those improvements show up as patches to WebKit or Firefox or GNOME or whatever else. Native UI elements need the improvements; that's where UI actually belongs. On mobile in particular, there's a couple of problems with the web-page approach to UI. One, it adds yet more stuff to download that "shouldn't" be nece…

Good points but I think you're preaching to the choir. The bottleneck is the W3C which is probably bogged with all sorts of red tape and politics.

In what way does the W3C block browsers from changing the UI of form controls? Most interesting innovation happens outside of the standard's committees, and as long as it is standardized in a reasonable amount of time, that's ok.

Re: Select2 - A better way to make select boxes (with jQuery)

#22

Maybe it's just me, but I tend to dislike loading 50kb (plus the CSS file) scripts into my applications unless the service is built around something that said script adds a ton of value for. I dunno, is 50kb relevant any longer? Still seems like the 50kb to 100kb range matters when adding in js files. At 5kb to 10kb I don't think much about it.

Minified and served compressed it's 8.51k for the JS and CSS together.

which is far from zero on 2G and edge, but whatever - Imho the real issue is how friggin slow is that going to be in a phone browser / how will the browser handle it (maemo nokia had a builtin handler for dropdowns for example).

As some said, I'd much rather see a push to chromium source than yet another ultra heavy js css component.

Re: Select2 - A better way to make select boxes (with jQuery)

#23

Obligatory: what's the difference between Select2 and Chosen? ( http://news.ycombinator.com/item?id=4074501 )

The biggest thing here is the AJAX loading of data. Like I said in that submission, Chosen really chokes if you have thousands of items in it.

Re: Select2 - A better way to make select boxes (with jQuery)

#27
post #13

It breaks normal usage. Tab to a normal Select, press 'n' 3 times and you get New Hampshire (the 3rd item starting with 'n'). Tab to Select2 press 'n' 3 times and you get nothing.

True but this also supports dynamically loaded data with infinite scrolling and other things that a normal select can't do. I suppose it's a trade off.

Re: Select2 - A better way to make select boxes (with jQuery)

#29

Earlier quoted context omitted.

It closes when I click outside of it.

Ah, it does on the computer. On the iPad and iPhone, it does not for some reason.

It's a one line fix, just the developer listening for a mousedown and not a touchstart event.

https://github.com/ivaynberg/select2/issues/77

Re: Select2 - A better way to make select boxes (with jQuery)

#30
post #13

It breaks normal usage. Tab to a normal Select, press 'n' 3 times and you get New Hampshire (the 3rd item starting with 'n'). Tab to Select2 press 'n' 3 times and you get nothing.

It also breaks two OSX defaults:

  - spacebar on a highlighted item should select it

  - the select menu should open on mousedown, not mouseup.
Otherwise, it's a very nice piece of work.
Post reply on HN