fix:dropdown losing focus when using scrollToFocus from anoter editfield #5186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The simplest possible solution i found to fixing an issue where selects with the "ui-grid-edit-dropdown" attribute would loose focus directly after getting it when trying to focus it with scrollToFocus while editing another field.
Simplified scenario: i have a textbox in the grid, if i type 2 i scrollToFocus to column 2, if i type 3 i scrollToFocus to column 3. This works great for all columns that isnt using the ui-grid-edit-dropdown attribute in the editTemplate. I compared the code for ui-grid-editor and ui-grid-edit-dropdown and noticed that ui-grid-editor has its elm[0].focus() inside a timeout. When applied to my issue this solved it,and it did not seem to cause any form of regression. Since it is already approved for use on the grid-editor attribute, i thought it would be reasonable to add it here too.
Did not know if i should add only the focus or everything in the timeout, so i went with least amount possible.