Skip to content

Commit

Permalink
Fix focus on CS rename keyboard interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Feb 11, 2021
1 parent 0b0dbdf commit 0288f06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void ColorSchemes::RenameAccept_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
{
_RenameCurrentScheme(NameBox().Text());
RenameButton().Focus(FocusState::Programmatic);
}

void ColorSchemes::RenameCancel_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
{
IsRenaming(false);
RenameErrorTip().IsOpen(false);
RenameButton().Focus(FocusState::Programmatic);
}

void ColorSchemes::NameBox_PreviewKeyDown(IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
Expand All @@ -246,6 +248,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
RenameErrorTip().IsOpen(false);
e.Handled(true);
}
ColorSchemeComboBox().Focus(FocusState::Programmatic);
}

void ColorSchemes::_RenameCurrentScheme(hstring newName)
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ the MIT License. See LICENSE in the project root for license information. -->
<!--Rename Button-->
<!--Bind IsEnabled to prevent a the color scheme from returning from the dead-->
<Button x:Uid="Rename"
x:Name="RenameButton"
Style="{StaticResource SmallButtonStyle}"
Click="Rename_Click"
IsEnabled="{x:Bind CanDeleteCurrentScheme, Mode=OneWay}">
Expand Down

0 comments on commit 0288f06

Please sign in to comment.