vue-typeahead-bootstrap
vue-typeahead-bootstrap copied to clipboard
Add focus event
Focus event may be useful for loading initial data for list instead of using mounted
hook for that case.
Also I added id
attribute for input for use with <label for="...">
.
I'm interested in this PR, but I'd like to understand it better.
Could you give a little more information about how'd you see using this event? I definitely think more events could be useful (#28), but I want to make sure we understand the use cases really well before adding too many. An API is a fragile thing, too few and there aren't enough options, too many and it's a mess to wade through.
Additionally, I know it seems petty, but could you make a separate PR for the id change? I mostly try to keep PRs to a single related purpose. The id
change you suggested makes me think about the whole concept of label
s and id
s and whether or not there should be a name
attribute as well. Also, what, if any, the default for those properties should be. But, I'd like to separate that discussion from the conversation about the focus event.
Hi, I am planning to create another issue but I saw this. I don't know if the "focus event" is the same with my issue.
So I tried to implement the typeahead in modal and I would like to have it in autofocus. So when the modal loads, the focus should be on the typeahead.
Is there a workaround to do this as I tried to add an ID but it doesn't add/append in the input element itself.
@darrinmn9, I know you were interested in this PR. I wasn't sure if you were interested in this implementation of the general idea. I'm onboard with the idea, but the PR could use a couple of touchups as I noted in my original comment.
agreed, and like you said, it should probably be 2 separate PRs, 1 for the @focus
event and 1 for the allowing a user specified id
to be passed to the input (which is valuable for accessibility to tie a <label for="...">
with the specific input).