Add option to disable keyboard navigation in ManagedTable
Summary: This may be needed e.g. if there are multiple ManagedTables in the window. Reviewed By: jknoxville, danielbuechele Differential Revision: D16620862 fbshipit-source-id: 1880e9e6e8e9ece5f687b2768eae7c4f206f69da
This commit is contained in:
committed by
Facebook Github Bot
parent
ea8a6546c9
commit
1717fba410
@@ -130,6 +130,10 @@ export type ManagedTableProps = {|
|
|||||||
* Table scroll horizontally, if needed
|
* Table scroll horizontally, if needed
|
||||||
*/
|
*/
|
||||||
horizontallyScrollable?: boolean,
|
horizontallyScrollable?: boolean,
|
||||||
|
/**
|
||||||
|
* Whether to allow navigation via arrow keys. Default: true
|
||||||
|
*/
|
||||||
|
enableKeyboardNavigation?: boolean,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
type ManagedTableState = {|
|
type ManagedTableState = {|
|
||||||
@@ -155,6 +159,7 @@ class ManagedTable extends React.Component<
|
|||||||
highlightableRows: true,
|
highlightableRows: true,
|
||||||
multiHighlight: false,
|
multiHighlight: false,
|
||||||
autoHeight: false,
|
autoHeight: false,
|
||||||
|
enableKeyboardNavigation: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
getTableKey = (): string => {
|
getTableKey = (): string => {
|
||||||
@@ -304,7 +309,8 @@ class ManagedTable extends React.Component<
|
|||||||
this.onCopy(false);
|
this.onCopy(false);
|
||||||
} else if (
|
} else if (
|
||||||
(e.keyCode === 38 || e.keyCode === 40) &&
|
(e.keyCode === 38 || e.keyCode === 40) &&
|
||||||
this.props.highlightableRows
|
this.props.highlightableRows &&
|
||||||
|
this.props.enableKeyboardNavigation
|
||||||
) {
|
) {
|
||||||
// arrow navigation
|
// arrow navigation
|
||||||
const {rows} = this.props;
|
const {rows} = this.props;
|
||||||
|
|||||||
Reference in New Issue
Block a user