-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Dropdown: Restore original selection on escape exit Fixes: #42487 #43152
Dropdown: Restore original selection on escape exit Fixes: #42487 #43152
Conversation
@raygervais |
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.
on ... prefix within object variable names typically is used to indicate event methods or event action variables.
Probably should you something like:
_currentSelection
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.
Within onEscape we should do a couple different things:
this.selectElement.selected = this.select(this._onOriginalSelect);
Not completely sure about the above. this.select()
does not return any value. Also this.selectElement.selected
does not exist.
We can just use:
this.select(this._onOriginalSelect);
Second:
I think we should actually not fire the onSelected event. Since we have not changed from the current selection I don't think it makes sense.
@raygervais Lastly I am still working on what to do with the native select. Keyboard events are handled very differently when a native HTML select is expanded. We may not be able to make that clean. FYI - I have to figure out how to quote code for reviews better , sorry 👎 |
@cleidigh, quoting code reviews this way deff keeps me on my toes, so I don't mind. It's all a learning process in the end for us all 👍. I've made the requested updates:
I'm curious how you are thinking of handling the native HTML select list, but again happy to learn and help. Sorry if this PR seems rather messy or a shot in the dark, I haven't worked in the side of Code before, nor have I interacted with custom select components. It's been a great eye-opener so far of how Code and UI Components work 😄 Question, when you said we should remove the select event, were you referring to lines such as https://github.com/Microsoft/vscode/blob/master/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts#L532 ? |
@cleidigh, when you have a chance to review / critique, I'd love to understand this further and fix any issues that exist with this PR 😄 Then I can do some final testing / logic changes where appropriate. 👍 PS. Renamed based on your comment from last PR, glad to follow a semantic which is much cleaner. I did leave WIP tag in just incase there is unstable functionally that my part added, will remove once you give go ahead. |
Update The issue appears to be the consequence of this.select(this._currentSelection); |
@raygervais |
@cleidigh, that comment was before the final commit with the single line change since I tested on Windows as well last night and found the fix / expected behavior to be relational to what I had noticed. This is resolved now in latest commit. |
@raygervais |
Yes, Sorry for the confusion, I really need to think of what to say before attempting voice dictation. The expected update / accessibility fix is here and working on both Windows and Linux. |
@raygervais I ask because I can only do voice programming based upon my disability. |
@raygervais Has the tweaks for restoring the initial selection upon Escape/passive blur I do not think we should to change the native select mode based on the following
|
@cleidigh, honestly I use dictation while I'm on the move such as walking home from work in the cold. Essentially, I dictate only when out and about. Curious what do you use for dictation? Furthermore, I do agree with the idea to not change native HTML select behaviour. 👍 |
Yeah I would not touch the native select box. |
@raygervais |
@raygervais One approach is to set this._currentSelection = -1 if:
Check out the following and try little more testing on Windows and Linux to see if we have everything private onListBlur(): void {
private onEnter(e: StandardKeyboardEvent): void {
|
Hi @cleidigh, I will correct and test tonight if time permitting. Thanks for the pointer! This will be me for the next few hours : |
@raygervais As a note, these types of issues and the ability to control them were one of the main impetus for replacing the limited native select. |
Noted @cleidigh, was curious why the need for a non-native drop down had developed.
I'm glad that I'm learning from this how very simple logic can influence the entire operation of a UI component. This level of scope (low level, singular component scope) is very different from my experience of high level full UI layout scope (interaction between components, much less data interaction and manipulation in a single component's scope). 👍 |
@raygervais I've been working with code for a year and still only know a fraction of the CodeBase. Cheers - don't hesitate on any questions in the future... |
@cleidigh, thanks for the awesome mentoring and tips! It really did help a lot with my navigational skills around code and the custom dropdown logic. I really hope to contribute more, and perhaps even play a part if you'd be so keen in helping port the custom dropdown component for MacOS instances! |
@raygervais BTW the custom drop-down was purposely only provided for windows and Linux. it was actually a design decision because the team thought the Mac version was good. if you inspect the code in particular selectbox.ts you will see the conditional for the platform: if you drop this condition the code will actually use the custom select box on all platforms , no porting necessary. You could propose a change such as a configurable parameter to use the custom select box on all platforms. this might be possible to add after some more feedback from users but if you want to you could go and create an issue now. |
Fixes #42487
Change new custom select (dropdown) to revert to current selection if user presses Escape or
blurs focus by pressing the mouse outside the drop-down.
The native select behavior remains unchanged by design.