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

[terra-clinical-item-view] Add property to separate by row or column when in two column layout #912

Merged
merged 5 commits into from
Sep 25, 2023

Conversation

RayGunY
Copy link
Contributor

@RayGunY RayGunY commented Aug 30, 2023

Summary

What was changed:

  • Added a trueColumn prop that defaults to true. When it is set to false it reverts to handling two column layout like it was before the changes in this PR. This means the screenreader will read out left to right, up to down. Also resizing/truncation/overflow will behave slightly differently (like it was working before) than trueColumn view because displays are being handled by row.
  • Added some styling changes to truncated content when it is in true two column view. There was a truncation issue when the ItemView itself didn't have isTruncated set to true but the ItemDisplays passed in did have isTruncated set. Added a check for the displays to see if isTruncated is set on them and if so then to use the truncated two column styling class. Added screenshots below to show the difference.
  • Added several tests for the above behavior of the different potential cases of left, right, or both having truncated displays.
  • I also pulled out some of the logic in the larger methods into their own smaller methods for readability.

Why it was changed:
So that users can have the option to use the old layout/handling for two column in case the new changes break anything for them. Also to fix truncation behavior for partial truncation.

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

This PR resolves:

UXPLATFORM-9563


VO and JAWs Readouts:

VO-twoColumn-by-row.mov
JAWS-readout-by-row.mov

True two column resizing behavior is the same as before (truncated and not truncated):

truncation_resize.mov
non_truncated_resize.mov

This is the partial truncation issue I fixed:

Before
partial_truncation_before

After
partial_truncation_after

@RayGunY RayGunY self-assigned this Aug 30, 2023
@RayGunY RayGunY changed the title [clinical-item-view] Add row vs column view prop [terra-clinical-item-view] Add property to separate by row or column when in two column layout Aug 30, 2023
Terra.validates.element('with truncation in one column', { selector: '#ItemView-one-wrap' });
Terra.validates.element('with truncation in two columns', { selector: '#ItemView-two-wrap' });
Terra.validates.element('with truncation in one column', { selector: '#ItemView-one-truncate' });
Terra.validates.element('with truncation in two columns', { selector: '#ItemView-two-truncate' });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noticed that previously this was not actually pointing to the tests for truncated content. So any of the 'with truncation in one column' or 'with truncation in two columns' snapshots are going to be changed for good reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also some of the 'with word wrap' images have changed a bit as well - just the sizing of that image has changed but not the actual word wrap/overflow behavior. I will post recordings in the description to show this.

@RayGunY
Copy link
Contributor Author

RayGunY commented Sep 8, 2023

@eawww @sycombs @sdadn this is ready to be looked at when you have a chance

@sdadn
Copy link
Contributor

sdadn commented Sep 11, 2023

How does this affect existing behavior? Will this change be passive?

@RayGunY
Copy link
Contributor Author

RayGunY commented Sep 11, 2023

How does this affect existing behavior? Will this change be passive?

@sdadn This is essentially adding back old code to make sure we maintain an option for passivity. When this new prop is false it will revert to using the logic we had before the most recent two column accessibility updates.

@RayGunY
Copy link
Contributor Author

RayGunY commented Sep 14, 2023

How does this affect existing behavior? Will this change be passive?

@sdadn This is essentially adding back old code to make sure we maintain an option for passivity. When this new prop is false it will revert to using the logic we had before the most recent two column accessibility updates.

@sdadn tagging again, just want to make sure you saw my response

Comment on lines +236 to +238
while (displaysSlice.length) {
displayGroups.push(displaysSlice.splice(0, 2));
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this pushing the same array information to the array multiple times?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, splice removes the first two displays from displaysSlice and pushes them together to displayGroups. So each time it's taking the top two off and pushing them. It's the same logic that was being used previously.

So displayGroups would look like [[display 1, display 2], [display 3, display 4], [display 5, display 6], [display 7, display 8]]. And by the end displaysSlice would be empty

Copy link
Contributor

@sdadn sdadn Sep 22, 2023

Choose a reason for hiding this comment

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

Ah right, splice mutates the original array as opposed to slice. +1

@@ -1,12 +1,19 @@
Terra.describeViewports('Clinical Item View', ['tiny', 'small', 'medium', 'large', 'huge', 'enormous'], () => {
it('with one column displays', () => {
it('with displays', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is following the previous sentence structure, but since we are updating these, we should reword these so it reads as a sentence starting with "it". E.g. "It renders with with displays" or any other more appropriate descriptor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure thing, cf417ee

@sdadn
Copy link
Contributor

sdadn commented Sep 21, 2023

@sdadn This is essentially adding back old code to make sure we maintain an option for passivity. When this new prop is false it will revert to using the logic we had before the most recent two column accessibility updates.

@RayGunY The old logic should be the default for passivity. A few consumers reported the recent updates causing issues. Though the question is if swapping the defaults breaks more or less consumers 😅.

@RayGunY
Copy link
Contributor Author

RayGunY commented Sep 22, 2023

@sdadn This is essentially adding back old code to make sure we maintain an option for passivity. When this new prop is false it will revert to using the logic we had before the most recent two column accessibility updates.

@RayGunY The old logic should be the default for passivity. A few consumers reported the recent updates causing issues. Though the question is if swapping the defaults breaks more or less consumers 😅.

I understand what you're saying Saad. @scott what do you think? I thought we wanted to push people towards using the new logic but have the option to keep the old logic for passivity.

@mjpalazzo
Copy link
Contributor

@RayGunY - The conflict between passivity and accessibility is the challenge we are facing. Because consumers have not made their accessibility updates yet, I think we need to go with the passive approach and emphasize in the accessibility guide that consumers must enable the prop when they are remediating for accessibility. Other thoughts?

@RayGunY
Copy link
Contributor Author

RayGunY commented Sep 22, 2023

@RayGunY - The conflict between passivity and accessibility is the challenge we are facing. Because consumers have not made their accessibility updates yet, I think we need to go with the passive approach and emphasize in the accessibility guide that consumers must enable the prop when they are remediating for accessibility. Other thoughts?

@mjpalazzo that works for me, just wasn't sure which is the bigger priority in this case. I can go ahead and change the default to use the old logic.

@RayGunY
Copy link
Contributor Author

RayGunY commented Sep 22, 2023

@sdadn prop default changes have been made here: 456b749

@@ -2,6 +2,9 @@

## Unreleased

* Added
* Added `trueColumn` prop so consumers can choose whether to separate displays in the two column layout by row or by column.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Added `trueColumn` prop so consumers can choose whether to separate displays in the two column layout by row or by column.
* Added `trueColumn` prop to toggle between displaying in a two column layout by row or by column.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/**
* Determines whether the displays are programmatically separated by row or as true columns when layout is set to `twoColumns`.
* Screenreaders will read `trueColumn` displays from top to bottom, one column at a time.
* However, this prop defaults to false and therefore the screenreader will read the displays in both columns together, left to right, one row at a time.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* However, this prop defaults to false and therefore the screenreader will read the displays in both columns together, left to right, one row at a time.
* However, this prop defaults to `false` and therefore the screenreader will read the displays in both columns together, left to right, one row at a time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

* Determines whether the displays are programmatically separated by row or as true columns when layout is set to `twoColumns`.
* Screenreaders will read `trueColumn` displays from top to bottom, one column at a time.
* However, this prop defaults to false and therefore the screenreader will read the displays in both columns together, left to right, one row at a time.
* For accessibility purposes it is recommended to set trueColumn to true.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* For accessibility purposes it is recommended to set trueColumn to true.
* For accessibility purposes it is recommended to set trueColumn to `true`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +236 to +238
while (displaysSlice.length) {
displayGroups.push(displaysSlice.splice(0, 2));
Copy link
Contributor

@sdadn sdadn Sep 22, 2023

Choose a reason for hiding this comment

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

Ah right, splice mutates the original array as opposed to slice. +1

Comment on lines 2 to 3
import IconBriefcase from 'terra-icon/lib/icon/IconBriefcase';
import IconPerson from 'terra-icon/lib/icon/IconPerson';
Copy link
Contributor

Choose a reason for hiding this comment

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

We can update these to use the new named exports introduced in cerner/terra-core#3915.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sdadn
Copy link
Contributor

sdadn commented Sep 22, 2023

We should probably have an example/code snippet where trueColumn=false and maybe compares it with trueColumn=true to highlight the differences.

@RayGunY
Copy link
Contributor Author

RayGunY commented Sep 25, 2023

We should probably have an example/code snippet where trueColumn=false and maybe compares it with trueColumn=true to highlight the differences.

@sdadn I believe I already have something that should cover that here: https://github.com/cerner/terra-clinical/pull/912/files#diff-d43cc843d972ecc662a6ef6a0bd194724cf3d97c03658812c7a0f855e209d881R41

The other two column examples on the page are all with trueColumn=true

@github-actions github-actions bot temporarily deployed to preview-pr-912 September 25, 2023 13:46 Destroyed
@sdadn
Copy link
Contributor

sdadn commented Sep 25, 2023

We should probably have an example/code snippet where trueColumn=false and maybe compares it with trueColumn=true to highlight the differences.

@sdadn I believe I already have something that should cover that here: https://github.com/cerner/terra-clinical/pull/912/files#diff-d43cc843d972ecc662a6ef6a0bd194724cf3d97c03658812c7a0f855e209d881R41

The other two column examples on the page are all with trueColumn=true

Ah I missed that. Looks good then!

@sdadn sdadn merged commit 8db93c2 into main Sep 25, 2023
@sdadn sdadn deleted the UXPLATFORM-9563 branch September 25, 2023 17:11
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.

7 participants