Skip to content

Commit

Permalink
fix(a11y): keyboard navigation changes of expand and selection buttons (
Browse files Browse the repository at this point in the history
#7048)

* added key down events for expand buttons

- Added key down event function for expand all and expand tree buttons. To enable expand button for Enter and Space Keys.

* added key-down event for row header button

* formatting changes

* added key down event for expand all button

* updated key down event for selection button

* added tab index to enable navigation

* added tab index for keyboard navigation
  • Loading branch information
MsDev88 authored and mportuga committed Oct 16, 2019
1 parent 29c4fb1 commit 9854f69
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/selection/src/js/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@
}

function selectButtonKeyDown(row, evt) {
if (evt.keyCode === 32) {
if (evt.keyCode === 32 || evt.keyCode === 13) {
evt.preventDefault();
selectButtonClick(row, evt);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div
class="ui-grid-selection-row-header-buttons ui-grid-icon-ok clickable"
ng-class="{'ui-grid-row-selected': row.isSelected}"
tabindex="0"
ng-click="selectButtonClick(row, $event)"
ng-keydown="selectButtonKeyDown(row, $event)"
role="checkbox"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div
role="button"
tabindex="0"
class="ui-grid-selection-row-header-buttons ui-grid-icon-ok"
ng-class="{'ui-grid-all-selected': grid.selection.selectAll}"
ng-click="headerButtonClick($event)"
Expand Down
10 changes: 10 additions & 0 deletions packages/tree-base/src/js/tree-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,11 @@
evt.stopPropagation();
uiGridTreeBaseService.toggleRowTreeState(self, row, evt);
};
$scope.treeButtonKeyDown = function (row, evt) {
if (evt.keyCode === 32 || evt.keyCode === 13) {
$scope.treeButtonClick(row, evt);
}
};
}
};
}]);
Expand Down Expand Up @@ -1645,6 +1650,11 @@
uiGridTreeBaseService.expandAllRows(self, evt);
}
};
$scope.headerButtonKeyDown = function (evt) {
if (evt.keyCode === 32 || evt.keyCode === 13) {
$scope.headerButtonClick(self, evt);
}
};
}
};
}]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div
class="ui-grid-tree-base-row-header-buttons"
tabindex="0"
ng-class="headerButtonClass()"
ng-click="headerButtonClick($event)">
ng-click="headerButtonClick($event)"
ng-keydown="headerButtonKeyDown($event)">
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div
class="ui-grid-tree-base-row-header-buttons"
ng-class="{'ui-grid-tree-base-header': row.treeLevel > -1 }"
tabindex="0"
ng-keydown="treeButtonKeyDown(row, $event)"
ng-click="treeButtonClick(row, $event)">
<i
ng-class="treeButtonClass(row)"
Expand Down

0 comments on commit 9854f69

Please sign in to comment.