ember-power-select icon indicating copy to clipboard operation
ember-power-select copied to clipboard

Public API to control selection

Open bjornharrtell opened this issue 6 years ago • 2 comments
trafficstars

It would be great to be able to set selectionStart, selectionEnd and possibly selectionDirection programmatically. It can also be used to set the cursor position by setting selectionStart = selectionEnd.

bjornharrtell avatar Oct 02 '19 13:10 bjornharrtell

I'm confused. What are the selectionStart and selectionEnd that you mention?

cibernox avatar Oct 05 '19 13:10 cibernox

Sorry for being vague. And I now realize this might only make sense after customizing ember-power-select as it's done at https://miguelcobain.github.io/ember-paper/#/components/autocomplete - i.e combining the search and trigger component into one.

The use case I have is when populating the search with certain content you might want to help the user by positioning the cursor to a placeholder position fx. to hint the user that they have chosen a road (represented by name + postalcode + city) and that they now should enter a number inbetween the road name and postalcode to filter the result down to individual adresses).

The mentioned properties are documented at https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement and what I'm after is to be able to mutate them. They are individually settable or with a single call using https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange.

bjornharrtell avatar Oct 05 '19 14:10 bjornharrtell