Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 7a663a6

Browse files
authored
Merge pull request #1417 from github/fixes/tree-view-keyboard-navigation
Fix PullRequest TreeView Keyboard navigation
2 parents 9a03978 + 981ad00 commit 7a663a6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestDetailView.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@
294294
Background="Transparent"
295295
BorderThickness="0"
296296
Margin="0 6 0 0"
297+
KeyUp="FileListKeyUp"
297298
MouseRightButtonDown="FileListMouseRightButtonDown"
298299
MouseDoubleClick="FileListMouseDoubleClick">
299300
<TreeView.ItemContainerStyle>
@@ -312,7 +313,8 @@
312313
</HierarchicalDataTemplate>
313314
<DataTemplate DataType="{x:Type vm:PullRequestFileNode}">
314315
<StackPanel Orientation="Horizontal"
315-
Tag="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ui:SectionControl}}}">
316+
Tag="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ui:SectionControl}}}"
317+
KeyboardNavigation.DirectionalNavigation="None">
316318
<ui:OcticonImage Icon="file_code" Margin="0,0,0,2">
317319
<ui:OcticonImage.Style>
318320
<Style TargetType="ui:OcticonImage" BasedOn="{StaticResource OcticonImage}">

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestDetailView.xaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,18 @@ void ShowErrorInStatusBar(string message, Exception e)
202202
ns?.ShowMessage(message + ": " + e.Message);
203203
}
204204

205+
private void FileListKeyUp(object sender, KeyEventArgs e)
206+
{
207+
if (e.Key == Key.Return)
208+
{
209+
var file = (e.OriginalSource as FrameworkElement)?.DataContext as IPullRequestFileNode;
210+
if (file != null)
211+
{
212+
DoDiffFile(file, false).Forget();
213+
}
214+
}
215+
}
216+
205217
void FileListMouseDoubleClick(object sender, MouseButtonEventArgs e)
206218
{
207219
var file = (e.OriginalSource as FrameworkElement)?.DataContext as IPullRequestFileNode;

0 commit comments

Comments
 (0)