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

[terra-dropdown-button] Add support for icons in split button #4080

Merged
merged 15 commits into from
Apr 4, 2024

Conversation

sycombs
Copy link
Contributor

@sycombs sycombs commented Apr 2, 2024

Summary

This PR updates the terra-dropdown-button SplitButton to support icon-only, left-aligned icon, and right-aligned icon buttons in order to maintain passivity for the Fusion passthrough.

Testing

This change was tested using:

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

Screenshots:

image

Reviews

In addition to engineering reviews, this PR needs:

  • UX review
  • Accessibility review
  • Functional review

Additional Details

This PR resolves:

UXPLATFORM-10337


Thank you for contributing to Terra.
@cerner/terra

@sycombs sycombs requested a review from a team as a code owner April 2, 2024 18:24
@sycombs sycombs self-assigned this Apr 2, 2024
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 2, 2024 18:45 Destroyed
]
],
"devDependencies": {
"terra-icon": "^3.60.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this as a devDependency for use in Jest tests

@@ -105,7 +105,11 @@ exports[`Dropdown Button correctly applies the theme context className 1`] = `
onKeyUp={[Function]}
type="button"
>
Primary Option
<span
className=""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we want to leave the className attribute blank here or just remove it entirely.

Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I'd probably removed it for cleaner look, unless I am missing something. What is a benefit of keeping it?

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 benefit, and I agree with you on the cleaner look. I'll remove it.

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: def249f

@mjpalazzo
Copy link
Contributor

@sycombs - The split button looks good and navigation is working. I observed on issue with JAWS where, when I Tab to the first button in the group, JAWS does not announce the name, role, value.
For the rest of the components in the composite JAWS works as expected: JAWS announces the name role value and helper text of the menu button and the expanded menu.

Copy link
Contributor

@adoroshk adoroshk Apr 2, 2024

Choose a reason for hiding this comment

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

It looks like text_first and icon_first are switched, as text first has actually icon first (unless I missed something)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, good catch! fixed in 40003a0

@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 2, 2024 19:21 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 2, 2024 19:33 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 2, 2024 20:00 Destroyed
@mjpalazzo
Copy link
Contributor

@sycombs - The split button looks good and navigation is working. I observed on issue with JAWS where, when I Tab to the first button in the group, JAWS does not announce the name, role, value. For the rest of the components in the composite JAWS works as expected: JAWS announces the name role value and helper text of the menu button and the expanded menu.

I rebooted by desktop and JAWS has returned to normal. The Split Button is working as required. Great work!

@@ -331,6 +331,26 @@ Terra.describeViewports('Split Button', ['medium'], () => {
});
});

describe('With icon', () => {
it('displays a button with icon first', () => {
browser.url('/raw/tests/cerner-terra-core-docs/dropdown-button/left-icon-split-button');
Copy link
Contributor

Choose a reason for hiding this comment

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

All these example seem pretty small, so I wonder if we can optimize these tests by having them all on the same page. Unless if it's not worth the effort.

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, combined them into one test/snapshot here: 7396391

Copy link
Contributor

Choose a reason for hiding this comment

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

That looks good! Can you also add text labels for easier identification?

e.g.

<h3>icon left</h3>
<iconLeftExample

<h3>icon right</h3>
<iconRightexample

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: f66ce00

@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 3, 2024 14:40 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 3, 2024 15:41 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 3, 2024 15:47 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 3, 2024 17:30 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 3, 2024 18:21 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 3, 2024 20:09 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 3, 2024 21:25 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-4080 April 4, 2024 13:34 Destroyed
@sycombs sycombs merged commit f6039eb into main Apr 4, 2024
22 checks passed
@sycombs sycombs deleted the split-button_add-icon branch April 4, 2024 13:58
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.

4 participants