[TF2] fix(econ): handle escape in combobox #1917
Open
SanyaKor wants to merge 1 commit into
Open
Conversation
Author
|
Note: I also found another related input issue. If you open Select Style or the refurbish/restoration dropdown, press Escape to return to gameplay, and then press the chat/team chat key ( input-bug-2.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
While playing TF2 casual, I noticed an issue with backpack combo overlay dialogs. Here is a video of the issue:
bug1.mp4
And if u play around with that it can gets even worse.
bug2.mp4
The Select Style window did not have complete Escape handling, especially for the combo box dropdown state.
I compared this behavior with
CConfirmDialogingame/client/econ/confirm_dialog.cpp. LikeCComboBoxBackpackOverlayDialogBase,CConfirmDialogis also based onvgui::EditablePanel.CConfirmDialoghandles Escape by overriding theEditablePanelkeyboard input method,OnKeyCodeTyped, and routing it through its normal cancel command:CComboBoxBackpackOverlayDialogBasedid not fully handle the same case. Adding Escape handling to the base overlay fixes the case where the overlay itself has focus. However,vgui::ComboBoxopens an internalvgui::Menufor its dropdown, and that menu takes focus while the dropdown is open. Because of that, Escape never reaches the parent overlay while the dropdown is active.This fix handles both focus paths:
CComboBoxBackpackOverlayDialogBasenow maps Escape toOnCommand("cancel"), similar toCConfirmDialog.ComboBoxEscapeaction signal back to the parent overlay.ComboBoxEscapeby calling the sameOnCommand("cancel")path.Here is the result after the fix:
fixed.mp4
Now Escape consistently closes the Select Style dialog whether focus is on the overlay itself or inside the opened combo box dropdown. The existing style selection/apply logic is unchanged.
This base combo overlay is not only used by Select Style (
CStyleSelectDialog). It is also used by the refurbish/restoration dialog (CRefurbishItemDialog) and by the strange part restriction selection dialog (CSelectStrangePartToRestrictDialog). The refurbish dialog can hit the same issue: for example, try restoring/removing a customization from a Strange weapon that has more than one Strange part, open the dropdown, and press Escape. The dropdown can close while the parent overlay remains open, which can leave the UI in the same awkward state.Example of issue with restoration
otherbug.mp4
I did not find an in-game issue with the strange part restriction flow (
CSelectStrangePartToRestrictDialog) during testing, but it shares the same base dropdown behavior. I do not expect forwarding Escape through the normal cancel path to break it. If a specific derived dialog ever needs different Escape behavior, it can override the relevant handler with an empty or custom implementation.