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

Use datalist instead of jquery-ui/autocomplete #2509

Merged
merged 2 commits into from
Jan 23, 2018

Conversation

jhawthorn
Copy link
Contributor

@jhawthorn jhawthorn commented Jan 18, 2018

Replaces jquery-ui/autocomplete, which is only used in the product properties page, with the html5 <datalist> element.

Browser support for datalist is patchy (notably no safari), but it is entirely fine for this page not to have autocompletion.

We had apparently already decided that the number of properties is few enough that they can be just dumped on the page as json. I'm keeping this assumption and just dumping them on the page as HTML.

Before

After (display will be browser and OS dependent)

See also #2469

Replaces jquery-ui/autocomplete, which is only used in the product
properties page, with the html5 <datalist> element.

Browser support for datalist is patchy (notably no safari), but it is
entirely fine for this page not to have autocompletion.

We had apparently already decided that the number of properties is low
enough that they can be just dumped on the page as json, so we might as
well dump them on the page as HTML.
@mtomov
Copy link
Contributor

mtomov commented Jan 20, 2018

Good choice!

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

TIL :ok-hand:

@tvdeyen
Copy link
Member

tvdeyen commented Jan 23, 2018

Just for reference. Select2 also has autocomplete functionality.

@jhawthorn
Copy link
Contributor Author

Select2 also has autocomplete functionality.

I don't think select2 can do what we need here. We want to have autocomplete (selection from a list), but we also want to be able to type a value not in our autocomplete list. select2 allows selecting a single value from a list (it's default behaviour), and it allows taking arbitrary typed input when it's taking multiple values as token input, but I don't think it can accept a single arbitrary value with suggestions (I could be wrong though).

@tvdeyen
Copy link
Member

tvdeyen commented Jan 23, 2018

It’s a little arkward but it’s doable https://github.com/AlchemyCMS/alchemy_cms/blob/master/app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee

I am not saying we should use select2, but as we already have the dependency it’s worth looking into it.

@jhawthorn jhawthorn merged commit 0ba913b into solidusio:master Jan 23, 2018
@jhawthorn jhawthorn mentioned this pull request Jan 24, 2018
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants