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

autoselect first entry in paper-autocomplete #871

Open
Sedrunum opened this issue Dec 21, 2017 · 12 comments
Open

autoselect first entry in paper-autocomplete #871

Sedrunum opened this issue Dec 21, 2017 · 12 comments

Comments

@Sedrunum
Copy link

Would it be possible to autoselect the first entry in the paper-autocomplete suggestions' list before any selection by the user as occured? This would make it possible to select this entry with one click on enter without having to use the arrow keys to select the entry in beforehand.

@miguelcobain
Copy link
Collaborator

Try to use a computed property on selected property.

Example:

selected: computed('options.[]', function() {
  let options = this.get('options');
  return options.get('length') ? options.get('firstObject') : null;
})

Not sure if this will work if options is a promise.

@xomaczar
Copy link
Contributor

Do you mean something like defaultHighlighted option ember-power-select has support for. http://ember-power-select.com/docs/api-reference

@Sedrunum
Copy link
Author

@miguelcobain What if I solely use the search attribute but not the options property
@xomaczar Yes, default highlighting is what I'm looking for but I'd like to stay inside ember-paper components.

@xomaczar
Copy link
Contributor

@Sedrunum should be straight forward to expose as we rely on eps primitives throughout

@xomaczar
Copy link
Contributor

xomaczar commented Jan 5, 2018

@miguelcobain what are your thoughts about exposing this as public API

@miguelcobain
Copy link
Collaborator

@xomaczar i think defaultHighlighted is quite different from what @Sedrunum was looking for.

He was looking for a default selection and defaultHighlighted is just the property that is highlighted when you open the dropdown. Am I missing something?

@xomaczar
Copy link
Contributor

xomaczar commented Jan 5, 2018

@miguelcobain from what I understand he wants to minimize the number of keypresses required to select an item. Currently, to select any items will require at least two keypresses (ArrowDown + Enter). If an item is highlighted when the dropdown opens up - will require only Enter to select it.
@Sedrunum correct me if I’m missing something

@Sedrunum
Copy link
Author

Sedrunum commented Jan 7, 2018

@xomaczar Exactly. This is what I'm looking for.

@Houndsto0th
Copy link

Is this still being discussed or will it be exposed as public API?

@xomaczar
Copy link
Contributor

Submit a PR with the feat.

@Houndsto0th
Copy link

I've opened a PR to remove that null declaration so users can interact with the defaultHighlighted property. #901 it looks like it failed a check that all other PRs are failing at the moment

@xomaczar
Copy link
Contributor

xomaczar commented Jul 3, 2018

@Sedrunum ember-paper supports defaultHighlighted option similar to e-p-s. This can be closed.

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

No branches or pull requests

4 participants