Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-worklist-data-grid] added keyboard support for column resizing #1813

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

sdadn
Copy link
Contributor

@sdadn sdadn commented Sep 28, 2023

Summary

This PR adds keyboard column support for the datagrid. Users can now navigate column headers and resize them using keyboard shortcuts.

Testing

This change was tested using:

  • WDIO
  • Jest
  • Visual testing (please attach a screenshot or recording)
  • Other (please describe below)
  • No tests are needed

Reviews

In addition to engineering reviews, this PR needs:

  • UX review
  • Accessibility review
  • Functional review

Additional Details

Note: due to the architecture changes to datagrid, this PR will not be merged into main. Instead, it will be used as a reference to integrate it into table & datagrid in a separate PR. This will still need review to finalize the design & implementation.

This PR resolves:

UXPLATFORM-9147


Thank you for contributing to Terra.
@cerner/terra

@sdadn sdadn self-assigned this Sep 28, 2023
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 2, 2023 15:31 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 2, 2023 16:14 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 2, 2023 18:18 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 2, 2023 19:05 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 2, 2023 20:09 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 2, 2023 20:51 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 2, 2023 21:09 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 3, 2023 15:17 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 3, 2023 18:37 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 3, 2023 19:10 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 3, 2023 20:45 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 5, 2023 20:00 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-1813 October 5, 2023 21:46 Destroyed
Comment on lines 218 to 230
const getTableHeight = () => {
if (columnHeaderCellRef.current) {
// Find parent table element
const parentTable = columnHeaderCellRef.current.closest('table');

// Update resize handle height to match parent table height
if (parentTable) {
return `${parentTable.offsetHeight}px`;
}
}

return null;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should no longer need this logic with the ResizeObserver being in the DataGrid component. You should be able to accept the table height as a prop and use directly. It will also allow you to remove the polyfill.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh i didn't commit those changes. Committed here: 82615a0

Comment on lines 126 to 131
const parentTable = resizeHandleRef.current.closest('table');

// Update resize handle height to match parent table height
if (parentTable) {
resizeHandleRef.current.style.height = `${parentTable.offsetHeight}px`;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to get the table height from the prop passed by the DataGrid component down to the subcomponents.

Copy link
Contributor Author

@sdadn sdadn Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed here: 526698c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and removed if block here: 9569340

<div
ref={resizeHandleRef}
draggable
role="slider"
role={!isNavigationEnabled ? 'slider' : 'divider'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use isNavigationEnabled instead of "!isNavigationEnabled" to deal with the positive case in the comparison?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reversed condition here: 04a321e

outline: 0 !important;
}

&:hover {
border-color: var(--terra-data-grid-resize-handle-hover-border-color, rgba(34, 42, 46, 0.6));
border-color: var(--terra-data-grid-resize-handle-hover-border-color, #909496);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should not be a need to change from RGBA to HEX. Also, I am not sure that this conversion is correctly accounting for opacity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was odd that this was using RGBA vs HEX in the other stylesheets but you're right about the opacity. Reverting it for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed here: 010c3f9

Copy link
Contributor

@eawww eawww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️⭐️⭐️⭐️⭐️... ⭐️

outline: 0 !important;
}

&:hover {
border-color: var(--terra-data-grid-resize-handle-hover-border-color, rgba(34, 42, 46, 0.6));
}
}

.resize-handle-selected {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this class just be "selected" instead of "resize-handle-selected" since it is localized? Also, we should be able to add this under the .resize-handle style block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here: 46c86b0

@@ -86,6 +86,7 @@ describe('ColumnHeader', () => {

// Validate ColumnHeaderCell React component
const columnHeaderCells = columnHeader.find(ColumnHeaderCell);
// console.log(columnHeaderCells.first().props())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to approve the review, but I think you are supposed to remove this line in the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch. Removed here: 429c450

@sdadn sdadn added ⭐ UX Reviewed UX Reviewed and approved. and removed UX Review Required labels Oct 24, 2023
@sdadn sdadn changed the base branch from main to wdg_column_resizing_feature October 24, 2023 21:39
@sdadn sdadn changed the base branch from wdg_column_resizing_feature to main October 24, 2023 21:40
@sdadn sdadn changed the base branch from main to wdg_column_resizing_feature October 25, 2023 13:17
@sdadn sdadn merged commit 8809618 into wdg_column_resizing_feature Oct 25, 2023
21 checks passed
@sdadn sdadn deleted the wdg_column_resizing branch October 25, 2023 13:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants