This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ta-grid/WorklistDataGrid.1/Examples.3/WorklistDataGridAutoFocusableCell.doc.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import WorklistDataGridAutoFocusableCell from './WorklistDataGridAutoFocusableCell?dev-site-example'; | ||
|
||
# Auto Focusable Cell Navigation | ||
|
||
### Description | ||
|
||
The content of a cell in the [Worklist Data Grid](/components/cerner-terra-framework-docs/data-grid/worklist-data-grid/about) may be empty, text, numerical, or any combination of widgets. | ||
When the only interactable element in the cell is a button or hyperlink element and the isAutoFocusable property is set to true, navigation to the cell will focus the button or hyperlink element directly. | ||
|
||
|
||
#### Keyboard Interactions | ||
|
||
|Key Interaction|Description| | ||
|-|-| | ||
|*Enter*|Moves focus to the button or hyperlink element when the table cell has focus.| | ||
|*Escape*|Moves focus to the parent table cell element.| | ||
|
||
|
||
<WorklistDataGridAutoFocusableCell /> |
69 changes: 69 additions & 0 deletions
69
...ev-site/doc/data-grid/WorklistDataGrid.1/Examples.3/WorklistDataGridAutoFocusableCell.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { useState } from 'react'; | ||
import { WorklistDataGrid } from 'terra-data-grid'; | ||
import NotificationDialog from 'terra-notification-dialog'; | ||
|
||
const WorklistDataGridAutoFocusableCell = () => { | ||
const rowHeaderIndex = 0; | ||
|
||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const handleCloseModal = () => { | ||
setIsOpen(false); | ||
}; | ||
|
||
const handleButtonOpenModal = () => { | ||
setIsOpen(true); | ||
}; | ||
|
||
const buttonCell = <button type="button" aria-label="Alert" onClick={handleButtonOpenModal}>Alert</button>; | ||
// eslint-disable-next-line react/forbid-dom-props | ||
const anchorCell = <a href="https://www.oracle.com/" aria-label="Visit Oracle">Visit Oracle</a>; | ||
|
||
const gridDataJSON = { | ||
cols: [ | ||
{ id: 'Column-0', displayName: 'Patient' }, | ||
{ id: 'Column-1', displayName: 'Action A' }, | ||
{ id: 'Column-2', displayName: 'Action B' }, | ||
], | ||
rows: [ | ||
{ | ||
id: '1', | ||
cells: [ | ||
{ content: 'Fleck, Arthur' }, | ||
{ content: buttonCell }, | ||
{ content: anchorCell }, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
const { cols, rows } = gridDataJSON; | ||
|
||
return ( | ||
<> | ||
{isOpen && ( | ||
<NotificationDialog | ||
variant="hazard-low" | ||
dialogTitle="Button from Focusable Cell" | ||
startMessage="Button Selected" | ||
acceptAction={{ | ||
text: 'OK', | ||
onClick: handleCloseModal, | ||
}} | ||
/> | ||
)} | ||
<WorklistDataGrid | ||
id="default-terra-worklist-data-grid-focusable-cell" | ||
overflowColumns={cols} | ||
defaultColumnWidth={170} | ||
rows={rows} | ||
rowHeaderIndex={rowHeaderIndex} | ||
rowHeight="50px" | ||
ariaLabel="Worklist Data Grid" | ||
isAutoFocusEnabled | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default WorklistDataGridAutoFocusableCell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters