Fix need for redundant enter when rename suggestions are not available [17.10] #73260
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.
Ports #73247 to
release/dev17.10
Context
In the current AI rename experience, developer needs to hit Enter twice to complete the rename.
Rename is completed only when user pressed enter and there is no popup with suggestions. Before suggestions were acquired automatically, first enter would close the popup and second enter would complete the rename.
When suggestions are acquired automatically, there is no popup but a list of suggestions. First enter "confirms" selection from the list and selects all text in the textbox. Second enter completes the rename. (We are deciding whether this is a good UX or if we'd like to change it).
Problem
The bug was that we required two enters even if the suggestions were hidden. i.e. user opted out from automatic rename suggestions, and we still required the first enter to "confirm"
in the gif, I'm hitting enter twice. first enter selects the content of the text box
Solution
When suggestions are not visible, don't require second enter
in the gif, I'm hitting enter just once
Notes on commit 1
Currently, we keep two enter behavior when suggestions are visible
in the gif, I'm hitting enter twice. first enter selects the content of the text box
Notes on commit 2
I really don't like the double enter behavior, and the fact that the rename text box content gets selected when suggestions arrive. I made changes in commit 2 to address these. With commit 2, the only time user hits enter twice is when the dropdown is visible (Smart Rename is ON, Automatically getting suggestions is OFF)
in the gif, I'm hitting enter once. when suggestions arrive, there is no select-all that'd cause me to overwrite what I typed so far
in the gif, I'm hitting enter twice because dropdown is used (Automatically getting suggestions is OFF). But notice there is no select-all