paper-listbox icon indicating copy to clipboard operation
paper-listbox copied to clipboard

no way to focus the selected item

Open davidmaxwaterman opened this issue 7 years ago • 2 comments

If you use the selected property to indicate which item is selected, it only bolds the text of the selected item. If you then click on the selected item, it then changes the appearance, which is counter-intuitive.

I am using a paper-listbox with paper-items, and I want to set which one is selected when the app starts and its appearance should be as if the user has selected it - ie it should also be focused.

There is a 'focusedItem', but no 'focusItem' property.

Is there some way to do what I want?

davidmaxwaterman avatar Jun 05 '18 13:06 davidmaxwaterman

You can use autofocus attribute on the paper-listbox like this:

<paper-listbox selected-item="{{selectedItem}}" selected="0" autofocus>
        <paper-item>123</paper-item>
        <paper-item>456</paper-item>
</paper-listbox>

romanzhivo avatar Jan 13 '20 10:01 romanzhivo

Hrm, thanks for that. It has been 'some time' since I filed this issue, and I can't really remember exactly what the problem is, or more importantly where in my code I was seeing it. However, I have dug around a bit and I don't see any problem any more, so I guess autofocus is default, or it is a problem that have been fixed in an upgrade - I think I've upgraded polymer and Google's Material Design elements since 2018. Anyway, I'll bear it in mind if I hit the problem again :)

davidmaxwaterman avatar Jan 13 '20 17:01 davidmaxwaterman