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

Make it possible to programmatically focus the vaadin-combo-box #349

Closed
JMuratha opened this issue Nov 25, 2016 · 4 comments
Closed

Make it possible to programmatically focus the vaadin-combo-box #349

JMuratha opened this issue Nov 25, 2016 · 4 comments
Assignees
Milestone

Comments

@JMuratha
Copy link

JMuratha commented Nov 25, 2016

It would be nice if you could add a focus function to the vaadin-combo-box to focus it programmatically.
For now im using comboBoxElement.$.input.focus() but it doesn't feels right to access the inner Element and with a focus function it would behave like a "normal" HTMLElement.

@samiheikki
Copy link
Contributor

Good idea 👍 I'll keep this issue open for further discussion within our team. Implementation is simple, but we are careful of not adding unnecessary functions/properties to our elements. Deprecating and removing a function from our API is always an hassle 😸

@Saulis
Copy link
Contributor

Saulis commented Dec 13, 2016

Adding API shouldn't be an issue since focus() is part of the native HTML element and thus is already included.

We could use the same approach which <paper-input> uses by making the host element focusable and delegating the focus and blur events down to the inner <input> element.

@Saulis Saulis added backlog and removed backlog labels Dec 13, 2016
@kito99
Copy link

kito99 commented Dec 15, 2016

@samiheikki this isn't unnecessary -- it is a requirement for business apps to be able to set focus on an input control :-).

@kito99
Copy link

kito99 commented Dec 15, 2016

FWIW, this is easy to do by working directly with the input:

this.$.comboBox.$.input.focus()

But of course this is using a child component (which isn't safe), and I'm not sure this works when shadow DOM is enabled.

@platosha platosha self-assigned this Feb 9, 2017
platosha added a commit that referenced this issue Feb 9, 2017
platosha added a commit that referenced this issue Feb 13, 2017
platosha added a commit that referenced this issue Feb 13, 2017
@Saulis Saulis added this to the 1.3.1 milestone Mar 6, 2017
manolo pushed a commit to vaadin/vaadin-combo-box-flow that referenced this issue Oct 3, 2020
manolo pushed a commit to vaadin/vaadin-combo-box-flow that referenced this issue Oct 3, 2020
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

6 participants