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

Feature Request: Opt out of focus() on _focusedItemChanged #96

Open
2 tasks done
jpodwys opened this issue Oct 27, 2017 · 2 comments
Open
2 tasks done

Feature Request: Opt out of focus() on _focusedItemChanged #96

jpodwys opened this issue Oct 27, 2017 · 2 comments

Comments

@jpodwys
Copy link

jpodwys commented Oct 27, 2017

Description

Currently, calling paper-listbox.select(n); causes the referenced list item to receive focus. This is problematic when users are typing with IME because stealing focus from the input that triggers the OS-level IME popup causes that popup to disappear.

More Info

I have a date/location picker typeahead. When the user types into the input, I open a paper-listbox instance and programmatically select the first item for them. Because doing so steals focus, I then immediately replace focus to the input. However, blurring the input causes IME tools to disappear.

Expected outcome

I would like to have an opt-in way to prevent focus of the selected list item, perhaps via a property named preventFocusOnItemChanged or something similar. I'd like for the desired item to be highlighted, but not focused. I've put together #97 (which has a diff of only 9 lines added) to accomplish this.

Live Demo

demo

Steps to reproduce

  1. Drop this element onto a page
  2. Wire it up to set its options property when a user types (preferably with a slight delay simulating a network call)
  3. Enable IME for Chinese
  4. Type "1990n" into the input in such a way that this line of code executes after typing the "n"
  5. Notice that iron-menu-behavior blurs the input causing the IME menu to disappear as seen in the gif above

Browsers Affected

  • Chrome
  • Firefox
    (Did not test others)
@jpodwys
Copy link
Author

jpodwys commented Nov 27, 2017

Let's celebrate the one month anniversary of this issue/pr combo by merging my PR! What do ya say?

@bicknellr @notwaldorf @cdata @rictic

@jpodwys jpodwys changed the title Feature Request: Opt out of fucus() on _focusedItemChanged Feature Request: Opt out of focus() on _focusedItemChanged Nov 27, 2017
@bicknellr
Copy link
Contributor

Hi @jpodwys, have you considered listening for the down key and setting the selected item to the first when the user pushes that? I think that's the typical way to handle this scenario if this is a generic input field with suggested options. I think you can also set .selected directly to avoid the focusing behavior.

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

2 participants