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

ArrowUp, ArrowDown and Enter are not working when input component is not on focus - e.g for use without input or when absolutely positioned over textarea #267

Open
1 of 3 tasks
zifnab87 opened this issue Jan 5, 2020 · 1 comment

Comments

@zifnab87
Copy link

zifnab87 commented Jan 5, 2020

I'm submitting a ...

  • bug report
  • feature request
  • support request

Thanks for your great work! It really has made my life easier by replacing a lot of boilerplate code of mine.

What is the current behavior?

Right now the user has to be on focus of input to use the arrow keys.

What is the expected behavior? / What is the motivation / use case for changing the behavior?

I am trying to make a suggestion like the @-mechanism (see attached screenshot) found e.g in Github and Facebook. This requires no input (which I can hide and I can position the suggestion-menu to be absolute). I have to open and close the list using $ref.[].showList() - $ref.[].hideList() but since I have added the controls configuration per the documentation it needs to work when the list is shown not just when the input is on focus. it would have been helpful if the list was shown by default if the list is not empty - so I don't need to call anything when the input is not on focus.

I was able to make it work and I have an example in case you want to put it somewhere in your documentation:

image

https://gist.github.com/zifnab87/3747a229f5157850475c0bb408e62af2

@zifnab87 zifnab87 changed the title ArrowUp, ArrowDown and Enter are not working when input component is not on focus ArrowUp, ArrowDown and Enter are not working when input component is not on focus - e.g for use without input and absolutely positioned Jan 5, 2020
@zifnab87 zifnab87 changed the title ArrowUp, ArrowDown and Enter are not working when input component is not on focus - e.g for use without input and absolutely positioned ArrowUp, ArrowDown and Enter are not working when input component is not on focus - e.g for use without input or when absolutely positioned over textarea Jan 5, 2020
@shrpne
Copy link
Contributor

shrpne commented Mar 17, 2020

IMHO, vue-simple-suggest should not handle global events and should only handle events which go directly to the component/input, because it adds complexity. However global event handler solves this use case (which I consed edge case) it makes troubles in another potential edge cases, e.g. multiple open autocomplete components.

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