React Grid users can use the keyboard to focus and control interactive elements (filters, buttons, editors). The Grid, however, does not provide full keyboard navigation support. This shortcoming, particularly evident in such use cases as Inline Cell Editing, decreases the Grid's overall accessibility.
A new TableKeyboardNavigation plugin allows you to enable built-in keyboard navigation.
const [focusedCell, setFocusedCell] = useState(null);
const {
rowKey, // A unique key that identifies a row; formatted as "RowType_RowId"
columnKey // A unique key that identifies a column; formatted as "ColumnType_ColumnName"
} = focusedCell;
...
<TableKeyboardNavigation
focusedCell={focusedCell}
onFocusedCellChange={setFocusedCell}
/>
const defaultFocusedRowId = 2;
const defaultFocusedColumn = "name";
const defaultFocusedCell = {
rowKey: `${Table.ROW_TYPE}_${defaultFocusedRowId}`,
columnKey: `${Table.COLUMN_TYPE}_${defaultFocusedColumn}`,
}
...
<TableKeyboardNavigation
defaultFocusedCell={focusedCell}
focusedRowEnabled // Applies a focused style to the row that contains the focused cell
/>
The following keys can be used:
The following keys can be used:
Do you find the keyboard navigation enhancements useful?
Subscribe to this thread or our Facebook and Twitter accounts for updates on this topic.
looks good but I'm also expecting some controls to toggle expanded rows, using Ctrl to do so recursively would be best
Hi @jesusgp22,
Thank you for your response. We don't plan to support built-in recursive expand. I suggest that you implement this scenario using tree data in controlled mode. Here is an example that illustrates how to do this. You can use it with Keyboard Navigation as well.
This seems like a good starting point. I would however ask you guys to also include shift-selection of ranges in the grid as an extension to this.
I think this feature will be a great addition. Do you have any experimental builds with it, or do you have a (very rough) ETA? We're trying to decide if we can wait for this feature, or if we should try to roll our own for the time being.
Most helpful comment
I think this feature will be a great addition. Do you have any experimental builds with it, or do you have a (very rough) ETA? We're trying to decide if we can wait for this feature, or if we should try to roll our own for the time being.