未验证 提交 2a1b75e8 编写于 作者: A Allison Chou 提交者: GitHub

Merge pull request #44974 from allisonchou/ChangeSignatureAccessibility

Fix change signature accessibility bugs
......@@ -48,20 +48,24 @@
<Thickness x:Key="textboxPadding">2</Thickness>
<vs:NegateBooleanConverter x:Key="NegateBooleanConverter"/>
<RoutedUICommand x:Key="MoveUp" />
<RoutedUICommand x:Key="MoveUpFocus" />
<RoutedUICommand x:Key="MoveDown" />
<RoutedUICommand x:Key="MoveDownFocus" />
<RoutedUICommand x:Key="MoveSelectionUp" />
<RoutedUICommand x:Key="MoveSelectionDown" />
<RoutedUICommand x:Key="ClickOK" />
<RoutedUICommand x:Key="ToggleRemovedState" />
</Window.Resources>
<Window.CommandBindings>
<CommandBinding Command="{StaticResource MoveUpFocus}" Executed="MoveUp_Click_FocusRow" />
<CommandBinding Command="{StaticResource MoveUp}" Executed="MoveUp_Click" />
<CommandBinding Command="{StaticResource MoveDownFocus}" Executed="MoveDown_Click_FocusRow" />
<CommandBinding Command="{StaticResource MoveDown}" Executed="MoveDown_Click" />
<CommandBinding Command="{StaticResource ToggleRemovedState}" Executed="ToggleRemovedState" />
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Key="Up" Modifiers="Alt" Command="{StaticResource MoveUp}" />
<KeyBinding Key="Down" Modifiers="Alt" Command="{StaticResource MoveDown}" />
<KeyBinding Key="Up" Modifiers="Alt" Command="{StaticResource MoveUpFocus}" />
<KeyBinding Key="Down" Modifiers="Alt" Command="{StaticResource MoveDownFocus}" />
<KeyBinding Key="Delete" Command="{StaticResource ToggleRemovedState}" />
<KeyBinding Key="Return" Command="{StaticResource ClickOK}" />
</Window.InputBindings>
......@@ -308,7 +312,7 @@
<ScrollViewer Name="Scroller"
AutomationProperties.Name="{Binding SignaturePreviewAutomationText}"
AutomationProperties.LabeledBy="{Binding ElementName=PreviewMethodSignatureLabel}"
IsTabStop="True"
IsTabStop="False"
Padding="8, 4, 4, 4"
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
Content="{Binding SignatureDisplay}"
......@@ -318,6 +322,7 @@
<StackPanel Name="ControlButtonsPanel" Grid.Column="1" Grid.Row="0" Height="Auto" Width="Auto" Margin="0, 3, 0, 0" >
<vs:DialogButton Name="UpButton"
AutomationProperties.Name="{Binding MoveUpAutomationText}"
ToolTip="{Binding MoveUpAutomationText}"
Margin="9 0 0 0"
IsEnabled="{Binding CanMoveUp, Mode=OneWay}"
AutomationProperties.AutomationId="UpButton"
......@@ -331,6 +336,7 @@
</vs:DialogButton>
<vs:DialogButton Name="DownButton"
AutomationProperties.Name="{Binding MoveDownAutomationText}"
ToolTip="{Binding MoveDownAutomationText}"
Margin="9 9 0 0"
IsEnabled="{Binding CanMoveDown, Mode=OneWay}"
AutomationProperties.AutomationId="DownButton"
......
......@@ -8,10 +8,8 @@
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ChangeSignature;
using Microsoft.VisualStudio.PlatformUI;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.ChangeSignature
{
......@@ -85,6 +83,18 @@ private void Cancel_Click(object sender, RoutedEventArgs e)
=> DialogResult = false;
private void MoveUp_Click(object sender, EventArgs e)
{
MoveUp_UpdateSelectedIndex();
SetFocusToSelectedRow(false);
}
private void MoveUp_Click_FocusRow(object sender, EventArgs e)
{
MoveUp_UpdateSelectedIndex();
SetFocusToSelectedRow(true);
}
private void MoveUp_UpdateSelectedIndex()
{
var oldSelectedIndex = Members.SelectedIndex;
if (_viewModel.CanMoveUp && oldSelectedIndex >= 0)
......@@ -93,11 +103,21 @@ private void MoveUp_Click(object sender, EventArgs e)
Members.Items.Refresh();
Members.SelectedIndex = oldSelectedIndex - 1;
}
SetFocusToSelectedRow();
}
private void MoveDown_Click(object sender, EventArgs e)
{
MoveDown_UpdateSelectedIndex();
SetFocusToSelectedRow(false);
}
private void MoveDown_Click_FocusRow(object sender, EventArgs e)
{
MoveDown_UpdateSelectedIndex();
SetFocusToSelectedRow(true);
}
private void MoveDown_UpdateSelectedIndex()
{
var oldSelectedIndex = Members.SelectedIndex;
if (_viewModel.CanMoveDown && oldSelectedIndex >= 0)
......@@ -106,8 +126,6 @@ private void MoveDown_Click(object sender, EventArgs e)
Members.Items.Refresh();
Members.SelectedIndex = oldSelectedIndex + 1;
}
SetFocusToSelectedRow();
}
private void Remove_Click(object sender, RoutedEventArgs e)
......@@ -118,7 +136,7 @@ private void Remove_Click(object sender, RoutedEventArgs e)
Members.Items.Refresh();
}
SetFocusToSelectedRow();
SetFocusToSelectedRow(true);
}
private void Restore_Click(object sender, RoutedEventArgs e)
......@@ -129,7 +147,7 @@ private void Restore_Click(object sender, RoutedEventArgs e)
Members.Items.Refresh();
}
SetFocusToSelectedRow();
SetFocusToSelectedRow(true);
}
private void Add_Click(object sender, RoutedEventArgs e)
......@@ -157,7 +175,7 @@ private void Add_Click(object sender, RoutedEventArgs e)
_viewModel.AddParameter(addedParameter);
}
SetFocusToSelectedRow();
SetFocusToSelectedRow(false);
}
private CallSiteKind GetCallSiteKind(AddParameterDialogViewModel addParameterViewModel)
......@@ -178,7 +196,7 @@ private CallSiteKind GetCallSiteKind(AddParameterDialogViewModel addParameterVie
: CallSiteKind.Value;
}
private void SetFocusToSelectedRow()
private void SetFocusToSelectedRow(bool focusRow)
{
if (Members.SelectedIndex >= 0)
{
......@@ -188,7 +206,7 @@ private void SetFocusToSelectedRow()
row = Members.ItemContainerGenerator.ContainerFromIndex(Members.SelectedIndex) as DataGridRow;
}
if (row != null)
if (row != null && focusRow)
{
FocusRow(row);
}
......@@ -216,7 +234,7 @@ private void MoveSelectionUp_Click(object sender, EventArgs e)
}
}
SetFocusToSelectedRow();
SetFocusToSelectedRow(true);
}
private void MoveSelectionDown_Click(object sender, EventArgs e)
......@@ -227,7 +245,7 @@ private void MoveSelectionDown_Click(object sender, EventArgs e)
Members.SelectedIndex = oldSelectedIndex + 1;
}
SetFocusToSelectedRow();
SetFocusToSelectedRow(true);
}
private void Members_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
......@@ -238,7 +256,7 @@ private void Members_GotKeyboardFocus(object sender, KeyboardFocusChangedEventAr
Members.SelectedIndex = _viewModel.GetStartingSelectionIndex();
}
SetFocusToSelectedRow();
SetFocusToSelectedRow(true);
}
private void ToggleRemovedState(object sender, ExecutedRoutedEventArgs e)
......@@ -253,7 +271,7 @@ private void ToggleRemovedState(object sender, ExecutedRoutedEventArgs e)
}
Members.Items.Refresh();
SetFocusToSelectedRow();
SetFocusToSelectedRow(true);
}
internal TestAccessor GetTestAccessor()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册