-
Notifications
You must be signed in to change notification settings - Fork 408
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
Hint is shown when menu is not visible #298
Comments
Yeah, I guess that's a little weird, though not the end of the world. The right behavior is probably to blur the input when the user hits esc. What do you think? |
Personally, I wouldn't expect the input to blur unless the user manually navigates away. In this case they're trying to dismiss the menu so IMO it should just act like any other text input when the options menu is not showing. Esc would just focus the user on the text field. (basically, reset to the state it would be in when the user first clicks on the input.) I think this should work pretty similar to a bootstrap multiselect. When you press esc to dismiss the options it keeps focus but hides the menu. - This is actually the current functionality, which is fine. The issue/expected behaviour is that rather than the hint text showing while the input is focused, it should only show while the menu is visible. A workaround i'm currently using isn't ideal, but it is to blur, then focus straight after, but obviously, It's firing off all these extra events that it shouldn't do if it was implemented natively. |
I'm using this example quite a bit - it has my workarounds/fixes in it. https://jsfiddle.net/alasdairhurst/mgwLfodx/2/ |
Why do you feel that's the case? |
From what I see, the point of the hint text should be to show what will be input once the typeahead autocomplete functionality is activated. I think we would both agree this is meaningless when the input has no focus since it doesn't reflect the current state of the input. The menu is shown when suggestons are available. The hint text would mirror the best match by default and the current selection if the user highlights something else in the menu. When the menu isn't shown, no suggestions are being shown. Since there's no autocomplete to activate while the menu is closed, the hint text doesn't really mean anything and gets in the way of the input value. Maybe a bad example but this is the idea: For example, we have a form with a username typeahead input. With my suggested approach, the user would only start seeing suggestions for "foobar" again once they start typing something new into the input box. Now, with the "default" behaviour of always showing the menu on focus, the functionality wouldn't really change. Then you have the option of a deferred menu TLDR: if the menu isn't showing, there aren't active suggestions so it doesn't seem right to keep suggesting in the hint text but not the menu. Probably repeated myself quite a bit, but hopefully you get the idea. |
Sounds reasonable, thanks for elaborating. |
Fixed in v2.3.2 |
Version 2.2.0
Steps to reproduce
Start typing to get a hint
press esc to hide the menu
Expected Behavior
hint is hidden when the menu is hidden
Actual Behavior
hint is always visible when the input is focused
The text was updated successfully, but these errors were encountered: