Skip to content
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

Workaround issue #1293 by avoiding setting textbox focus on Mac #1314

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Atlassian.Bitbucket.UI.ViewModels;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using GitCredentialManager;
using GitCredentialManager.UI.Controls;

namespace Atlassian.Bitbucket.UI.Views
Expand Down Expand Up @@ -44,11 +45,15 @@ public void SetFocus()
_tabControl.SelectedIndex = 1;
if (string.IsNullOrWhiteSpace(vm.UserName))
{
_userNameTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_userNameTextBox.Focus();
}
else
{
_passwordTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_passwordTextBox.Focus();
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/shared/Core/UI/Views/CredentialsView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ public void SetFocus()

if (string.IsNullOrWhiteSpace(vm.UserName))
{
_userNameTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_userNameTextBox.Focus();
}
else
{
_passwordTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_passwordTextBox.Focus();
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/shared/GitHub/UI/Controls/SixDigitInput.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using GitCredentialManager;
using GitCredentialManager.UI.Controls;

namespace GitHub.UI.Controls
Expand Down Expand Up @@ -86,7 +87,9 @@ private void SetTextBoxes(string text)

public void SetFocus()
{
KeyboardDevice.Instance.SetFocusedElement(_textBoxes[0], NavigationMethod.Tab, KeyModifiers.None);
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
KeyboardDevice.Instance.SetFocusedElement(_textBoxes[0], NavigationMethod.Tab, KeyModifiers.None);
}

private void SetUpTextBox(TextBox textBox)
Expand Down
13 changes: 10 additions & 3 deletions src/shared/GitHub/UI/Views/CredentialsView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using GitCredentialManager;
using GitHub.UI.ViewModels;
using GitCredentialManager.UI.Controls;

Expand Down Expand Up @@ -53,19 +54,25 @@ public void SetFocus()
else if (vm.ShowTokenLogin)
{
_tabControl.SelectedIndex = 1;
_tokenTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_tokenTextBox.Focus();

}
else if (vm.ShowBasicLogin)
{
_tabControl.SelectedIndex = 2;
if (string.IsNullOrWhiteSpace(vm.UserName))
{
_userNameTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_userNameTextBox.Focus();
}
else
{
_passwordTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_passwordTextBox.Focus();
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/shared/GitHub/UI/Views/TwoFactorView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using GitCredentialManager;
using GitHub.UI.Controls;
using GitCredentialManager.UI.Controls;

Expand All @@ -23,7 +24,9 @@ private void InitializeComponent()

public void SetFocus()
{
_codeInput.SetFocus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_codeInput.SetFocus();
}
}
}
13 changes: 10 additions & 3 deletions src/shared/GitLab/UI/Views/CredentialsView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using GitCredentialManager;
using GitLab.UI.ViewModels;
using GitCredentialManager.UI.Controls;

Expand Down Expand Up @@ -48,18 +49,24 @@ public void SetFocus()
else if (vm.ShowTokenLogin)
{
_tabControl.SelectedIndex = 1;
_tokenTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_tokenTextBox.Focus();
}
else if (vm.ShowBasicLogin)
{
_tabControl.SelectedIndex = 2;
if (string.IsNullOrWhiteSpace(vm.UserName))
{
_userNameTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_userNameTextBox.Focus();
}
else
{
_passwordTextBox.Focus();
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
_passwordTextBox.Focus();
}
}
}
Expand Down