-
Notifications
You must be signed in to change notification settings - Fork 72
[terra-data-grid] Flowsheet keyboard navigation #1927
Conversation
text={text} | ||
isOpen={hasSectionButton ? !isCollapsed : undefined} | ||
isTitleFixed | ||
onClick={hasSectionButton ? handleClick : undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I observed that if SPACE button was pressed on focused section, it does both - first opens the section, then closes it. Per discussion with @cm9361 it become clear that the second toggle is happening due to section header button being triggered as well.
I guess it can be fixed with onKeyDown event handler added to intercept a SPACE key press only:
onClick={hasSectionButton ? handleClick : undefined} | |
onClick={hasSectionButton ? handleClick : undefined} | |
onKeyDown={handleKeyDown} |
where
const handleKeyDown = (event) => {
const key = event.keyCode;
// Intercept the SPACE key only
if (key === KeyCode.KEY_SPACE) {
onSectionSelect(id);
event.preventDefault();
}
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have to make an update in terra-core to fix this behavior. I don't think the update should be part of this PR.
I tested the flowsheet sections keyboard navigation. Observed results:
|
// ------------------------------------- | ||
|
||
const isGridActive = grid.current?.contains(document.activeElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪 Nice use of JS to track the grid active state!
} | ||
|
||
setFocusedRowCol(toCell.row, toCell.col, true); | ||
}; | ||
|
||
const handleColumnSelect = useCallback((columnId) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Will we have to account for scenarios where a cell/column header can be selected without having been reached from a mousedown or keyboard navigation? I would not think so but removing these could affect that scenario if it is a concern. I know that JAWS has a quick navigation ability so I was wondering about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This event only triggered for the mouse down and spacebar being pressed. I think this new implementation is equivalent.
|
||
// browser.keys(['Shift', 'Tab']); | ||
// expect(browser.$('thead th:nth-child(2)').isFocused()).toBe(true); | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Why is this being commented out? We should be testing that the last available column is selected if the last focused column index doesn't exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not be removing the column during the click event. We are mutating the object in the middle of an event. There should be another way to remove the column such as a button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, I believe we should make a comment that this test ought to be changed. We clearly should be testing this behavior but if this was implemented incorrectly, then we should take a note of that to be addressed?
Hi, @adoroshk - The command is Ctrl+Fn+(Right/Left) Arrow |
Validated several examples with Edge and Chrome. Keyboard interactions are working as expected. I also tested several examples with JAWS. I was able to navigate with the screen reader and hear announcements as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High level check looks good. Approving to unblock Kenny but will dive deeper and log any issues found.
Summary
What was changed:
The Terra Table and Flowsheet components were updated to facilitate proper keyboard navigation within the Flowsheet data grid component.
Why it was changed:
The ability to use keyboard navigation is a core accessibility requirement of a grid control.
Testing
This change was tested using:
Reviews
In addition to engineering reviews, this PR needs:
Additional Details
N/A
This PR resolves:
UXPLATFORM-9403
UXPLATFORM-9911
Thank you for contributing to Terra.
@cerner/terra