-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix: issue #877 Typing fast in firefox skips the second character #1785
base: master
Are you sure you want to change the base?
Conversation
…events losing keystrokes
src/uiSelectController.js
Outdated
@@ -163,8 +161,12 @@ uis.controller('uiSelectCtrl', | |||
}; | |||
|
|||
ctrl.focusSearchInput = function (initSearchValue) { | |||
ctrl.search = initSearchValue || ctrl.search; | |||
if (initSearchValue) { | |||
ctrl.search = initSearchValue.val() || ctrl.search; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree that initSearchValue
should be a DOM element, angular controllers should avoid dealing with DOM. Can you look at leaving this as text string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I adjusted the code.
I would like to use the fix in this pull request because it is rather annoying that the second character is skipped while typing fast. |
@Plus3531 |
@piebe Can you add tests and possibly a Plunkr example for quicker evaluation? |
I love to help but... I am not sure what you want to see in the plunkr. As described in #877 the problem can be reproduced in the standard demo plunkr using Firefox. Also I do not know how to create a test to simulate fast typing by a user in Firefox. |
Changing the focus on elements does not always go fast enough in firefox to reliably catch all keystrokes. This fix changes the order of events, and keeps catching keystrokes after the first until the focus has shifted.
(I messed up the original pull request #896) Also see #877