A redo of #6290. That PR was overkill. In that one, we'd toss focus back to the active control any time that the tab view item got focus. That's maybe not the _best_ solution. Instead, this PR is precision strikes. We're re-using a lot of what we already have from #9260. * When the context menu is closed, yeet focus to the control. * When the renamer is dismissed, yeet focus to the control. * When the TabViewItem is tapped (meaning no one else handled it), yeet focus to the control. ### checklist * [x] I work here * [ ] This is UI so it doesn't have tests * [x] Closes #3609 * [x] Closes #5750 * [x] Closes #6680 ### scenarios: * [x] focus the window by clicking on the tab -> Control is focused. * [x] Open the color picker with the context menu, can move the focus inside the picker with the arrow keys. * [x] Dismiss the picker with esc -> Control is focused. * [x] Dismiss the picker with enter -> Control is focused. * [x] Dismiss the renamer with esc -> Control is focused. * [x] Dismiss the renamer with enter -> Control is focused. * [x] Dismiss the context menu with esc -> Control is focused. * [x] Start renaming, then click on the tab -> Rename is committed, Control is focused. * [x] Start renaming, then click on the text box -> focus is still in the text box
38 lines
1 KiB
C++
38 lines
1 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- SettingsTab.h
|
|
|
|
Abstract:
|
|
- The SettingsTab is a tab whose content is a Settings UI control. They can
|
|
coexist in a TabView with all other types of tabs, like the TerminalTab.
|
|
There should only be at most one SettingsTab open at any given time.
|
|
|
|
Author(s):
|
|
- Leon Liang - October 2020
|
|
|
|
--*/
|
|
|
|
#pragma once
|
|
#include "TabBase.h"
|
|
#include "SettingsTab.g.h"
|
|
#include "../../cascadia/inc/cppwinrt_utils.h"
|
|
|
|
namespace winrt::TerminalApp::implementation
|
|
{
|
|
struct SettingsTab : SettingsTabT<SettingsTab, TabBase>
|
|
{
|
|
public:
|
|
SettingsTab(winrt::Microsoft::Terminal::Settings::Editor::MainPage settingsUI);
|
|
|
|
void UpdateSettings(Microsoft::Terminal::Settings::Model::CascadiaSettings settings);
|
|
void Focus(winrt::Windows::UI::Xaml::FocusState focusState) override;
|
|
|
|
private:
|
|
void _MakeTabViewItem() override;
|
|
winrt::fire_and_forget _CreateIcon();
|
|
};
|
|
}
|