@@ -519,10 +519,11 @@ webui.SideBarView = function(mainView, noEventHandlers) {
519
519
if ( $ ( "#btn_createList" ) . length == 0 ) {
520
520
var newBranchForm = $ ( '#sidebar-local-branches' ) ;
521
521
522
- var inputForm = '<button type="submit" class="btn btn-md btn-default btn-ok" id="btn_createList">' +
522
+ var inputForm = '<input type="text" class="form-control form-control-xs" id="newBranchName"/>' +
523
+ '<button type="submit" class="btn btn-md btn-default btn-ok" id="btn_createList">' +
523
524
webui . checkIcon +
524
- '</button>' +
525
- '<input type="text" class="form-control form-control-xs" id="newBranchName"/>'
525
+ '</button>'
526
+
526
527
newBranchForm . append ( inputForm ) ;
527
528
$ ( "#sidebar-local-branches input" ) . focus ( ) ;
528
529
}
@@ -994,81 +995,120 @@ webui.SideBarView = function(mainView, noEventHandlers) {
994
995
self . mainView = mainView ;
995
996
self . currentContext = self . getCurrentContext ( ) ;
996
997
self . element = $ ( '<div id="sidebar">' +
997
- '<a href="#" data-toggle="modal" data-target="#help-modal"><img id="sidebar-logo" src="img/git-logo.png"></a>' +
998
+ '<a href="#" data-toggle="modal" data-target="#help-modal" tabindex="0" ><img id="sidebar-logo" src="img/git-logo.png"></a>' +
998
999
'<h5 id="packageVersion"></h5>' +
999
1000
'<h4 id="environment"></h4>' +
1000
1001
'<div id="sidebar-content">' +
1001
1002
'<section id="sidebar-workspace">' +
1002
- '<h4>Workspace</h4>' +
1003
+ '<h4 tabindex="0" >Workspace</h4>' +
1003
1004
'</section>' +
1004
1005
'<section id="sidebar-stash">' +
1005
- '<h4>Stash</h4>' +
1006
+ '<h4 tabindex="0" >Stash</h4>' +
1006
1007
'</section>' +
1007
1008
'<section id="sidebarDiscarded">' +
1008
- '<h4>Discarded Files</h4>' +
1009
+ '<h4 tabindex="0" >Discarded Files</h4>' +
1009
1010
'</section>' +
1010
- '<section id="sidebar-local-branches">' +
1011
+ '<section id="sidebar-local-branches" >' +
1011
1012
'<h4 class="mt-1">Local Branches' +
1012
- '<button type="button" class="btn btn-default btn-sidebar-icon btn-add shadow-none" title="Create new branch">' +
1013
+ '<button type="button" class="btn btn-default btn-sidebar-icon btn-add shadow-none" title="Create new branch" tabindex="0" >' +
1013
1014
webui . circlePlusIcon +
1014
1015
'</button>' + '</h4>' +
1015
1016
'</section>' +
1016
- '<section id="sidebar-remote-branches">' +
1017
+ '<section id="sidebar-remote-branches" >' +
1017
1018
'<h4 class="mt-1">Remote Branches' +
1018
- '<button type="button" class="btn btn-default btn-sidebar-icon btn-prune-remote-branches shadow-none" title="Git fetch of remote branches">' +
1019
+ '<button type="button" class="btn btn-default btn-sidebar-icon btn-prune-remote-branches shadow-none" title="Git fetch of remote branches" tabindex="0 " >' +
1019
1020
webui . refreshIcon +
1020
1021
'</button>' + '</h4>' +
1021
1022
'</section>' +
1022
1023
'<section id="sidebar-tags">' +
1023
1024
'<h4>Tags</h4>' +
1024
1025
'</section>' +
1025
1026
'<section id="space-filler"></section>' +
1026
- '<section id="sidebar-settings">' +
1027
- '<h4>Settings</h4>' +
1028
- '</section>' +
1029
- '<section id="sidebar-context" data-toggle="tooltip" data-placement="right" title="' + self . currentContext + '">' +
1030
- '<h4>Change Context</h4>' +
1027
+ '<section id="sidebar-home" tabindex="0">' +
1028
+ '<h4>Home</h4>' +
1031
1029
'</section>' +
1032
1030
'<section id="sidebar-vscode">' +
1033
- '<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
1031
+ '<h4><a href="vscode-workspace" target="_blank" tabindex="0" >Code Workspace</a></h4>' +
1034
1032
'</section>' +
1035
- '<section id="sidebar-home">' +
1036
- '<h4>Home</h4>' +
1033
+ '<section id="sidebar-context" data-toggle="tooltip" data-placement="right" title="' + self . currentContext + '" tabindex="0">' +
1034
+ '<h4>Change Context</h4>' +
1035
+ '</section>' +
1036
+ '<section id="sidebar-settings" tabindex="0">' +
1037
+ '<h4>Settings</h4>' +
1037
1038
'</section>' +
1038
1039
'</div>' +
1039
1040
'</div>' ) [ 0 ] ;
1040
1041
1041
1042
if ( webui . viewonly ) {
1042
1043
$ ( "#sidebar-workspace" , self . element ) . remove ( ) ;
1043
1044
} else {
1045
+ function onKeydown ( e , outcome ) {
1046
+ if ( e . key === "Enter" || e . key === " " ) {
1047
+ outcome ( )
1048
+ }
1049
+ }
1050
+
1044
1051
var workspaceElement = $ ( "#sidebar-workspace h4" , self . element ) ;
1045
- workspaceElement . click ( function ( event ) {
1052
+ function navigateToWorkspace ( ) {
1046
1053
$ ( "*" , self . element ) . removeClass ( "active" ) ;
1047
1054
workspaceElement . addClass ( "active" ) ;
1048
1055
self . mainView . workspaceView . show ( ) ;
1056
+ }
1057
+ workspaceElement . click ( function ( event ) {
1058
+ navigateToWorkspace ( )
1049
1059
} ) ;
1060
+ workspaceElement . on ( "keydown" , function ( e ) {
1061
+ onKeydown ( e , navigateToWorkspace )
1062
+ } )
1050
1063
1051
1064
var stashElement = $ ( "#sidebar-stash h4" , self . element ) ;
1052
- stashElement . click ( function ( event ) {
1065
+ function navigateToStash ( ) {
1053
1066
$ ( "*" , self . element ) . removeClass ( "active" ) ;
1054
1067
stashElement . addClass ( "active" ) ;
1055
1068
self . mainView . stashView . update ( 0 ) ;
1069
+ }
1070
+ stashElement . click ( function ( event ) {
1071
+ navigateToStash ( )
1056
1072
} ) ;
1073
+ stashElement . on ( "keydown" , function ( e ) {
1074
+ onKeydown ( e , navigateToStash )
1075
+ } )
1057
1076
1058
1077
var discardedElement = $ ( "#sidebarDiscarded" , self . element ) ;
1059
- discardedElement . click ( function ( ) {
1078
+ function navigateToDiscard ( ) {
1060
1079
$ ( "*" , self . element ) . removeClass ( "active" ) ;
1061
1080
discardedElement . addClass ( "active" ) ;
1062
1081
self . mainView . discardedView . show ( ) ;
1082
+ }
1083
+ discardedElement . click ( function ( ) {
1084
+ navigateToDiscard ( )
1063
1085
} ) ;
1086
+ discardedElement . on ( "keydown" , function ( e ) {
1087
+ onKeydown ( e , navigateToDiscard )
1088
+ } )
1064
1089
1065
1090
$ ( ".btn-add" , self . element ) . click ( self . createNewLocalBranch ) ;
1066
1091
$ ( '.btn-prune-remote-branches' , self . element ) . click ( self . pruneRemoteBranches ) ;
1067
1092
$ ( "#sidebar-settings" , self . element ) . click ( self . goToSettingsPage ) ;
1093
+ $ ( "#sidebar-settings" , self . element ) . on ( "keydown" , function ( e ) {
1094
+ if ( e . key === "Enter" || e . key === " " ) {
1095
+ self . goToSettingsPage ( ) ;
1096
+ }
1097
+ } ) ;
1068
1098
$ ( "#sidebar-context" , self . element ) . click ( function ( ) {
1069
1099
self . changeContextGet ( 0 ) ;
1070
1100
} ) ;
1101
+ $ ( "#sidebar-context" , self . element ) . on ( "keydown" , function ( e ) {
1102
+ if ( e . key === "Enter" || e . key === " " ) {
1103
+ self . changeContextGet ( 0 ) ;
1104
+ }
1105
+ } ) ;
1071
1106
$ ( "#sidebar-home" , self . element ) . click ( self . goToHomePage ) ;
1107
+ $ ( "#sidebar-home" , self . element ) . on ( "keydown" , function ( e ) {
1108
+ if ( e . key === "Enter" || e . key === " " ) {
1109
+ self . goToHomePage ( ) ;
1110
+ }
1111
+ } ) ;
1072
1112
}
1073
1113
1074
1114
// Removing the link to home if not a top-level page
@@ -1350,12 +1390,12 @@ webui.LogView = function(historyView) {
1350
1390
if ( type == 'revert' ) {
1351
1391
webui . git_command ( [ "revert" , "--no-commit" , "HEAD" ] , function ( output ) {
1352
1392
webui . showSuccess ( output ) ;
1353
- updateSideBar ( ) ; ;
1393
+ updateSideBar ( ) ;
1354
1394
} ) ;
1355
1395
} else if ( type == 'hardReset' ) {
1356
1396
webui . git_command ( [ "reset" , "--hard" , "HEAD~1" ] , function ( output ) {
1357
1397
webui . showSuccess ( output ) ;
1358
- updateSideBar ( ) ; ;
1398
+ updateSideBar ( ) ;
1359
1399
} ) ;
1360
1400
}
1361
1401
0 commit comments