Bug 1520107 - fix focus and keyboard triggered context menu handling in a11y panel tree. r=gl

MozReview-Commit-ID: 2kzvA2Eb1eF

Differential Revision: https://phabricator.services.mozilla.com/D16986
This commit is contained in:
Yura Zenevich
2019-01-19 18:13:55 +00:00
parent 6c5ce840ce
commit 4358b687fe
4 changed files with 34 additions and 18 deletions

View File

@@ -117,6 +117,8 @@ define(function(require, exports, module) {
onSort: PropTypes.func,
// Custom row click callback
onClickRow: PropTypes.func,
// Tree context menu event handler
onContextMenuTree: PropTypes.func,
// A header is displayed if set to true
header: PropTypes.bool,
// Long string is expandable by a toggle button
@@ -512,8 +514,8 @@ define(function(require, exports, module) {
const classNames = ["treeTable"];
this.rows = [];
const { className, onContextMenuTree } = this.props;
// Use custom class name from props.
const className = this.props.className;
if (className) {
classNames.push(...className.split(" "));
}
@@ -541,6 +543,7 @@ define(function(require, exports, module) {
},
tabIndex: 0,
onKeyDown: this.onKeyDown,
onContextMenu: onContextMenuTree && onContextMenuTree.bind(this),
"aria-label": this.props.label || "",
"aria-activedescendant": this.state.selected,
cellPadding: 0,
@@ -548,7 +551,6 @@ define(function(require, exports, module) {
TreeHeader(props),
dom.tbody({
role: "presentation",
tabIndex: -1,
}, rows)
)
);