Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: splitButton accessibility improvements #1458

Merged
merged 5 commits into from
Mar 19, 2024

Conversation

Chisomchima
Copy link
Contributor

@Chisomchima Chisomchima commented Feb 22, 2024

update accessibility in SplitButton component


Description

Implemented LIBS-566 by updating the SplitButton component to improve accessibility. This includes adding title and aria-label attributes to the toggle button to provide better context for screen readers. Additionally, made the splitButton close when the escape button is closed.


Known issues

  • None

Checklist

  • API docs are generated
  • Tests were added
  • Storybook demos were added

Screenshots

  • None

Additional Notes

  • Updated the SplitButton component to include title and aria-label attributes for improved accessibility.
  • Allowed use of "escape" button on the keyboard to close the split button.
  • Tests were added to ensure proper functionality and accessibility.
  • Reviewed and updated relevant documentation.

supporting text

@Chisomchima Chisomchima requested a review from a team as a code owner February 22, 2024 14:02
@Chisomchima Chisomchima marked this pull request as draft February 22, 2024 14:02
@dhis2-bot
Copy link
Contributor

dhis2-bot commented Feb 22, 2024

🚀 Deployed on https://pr-1458--dhis2-ui.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify February 22, 2024 14:06 Inactive
Copy link

cypress bot commented Feb 22, 2024

Passing run #3280 ↗︎

0 584 0 0 Flakiness 0

Details:

refactor: apply code review comments (pairing session)
Project: ui Commit: e1400a37ca
Status: Passed Duration: 07:32 💡
Started: Mar 18, 2024 4:58 PM Ended: Mar 18, 2024 5:06 PM

Review all test suite changes for PR #1458 ↗︎

@dhis2-bot dhis2-bot temporarily deployed to netlify February 27, 2024 07:41 Inactive
@Chisomchima Chisomchima marked this pull request as ready for review February 27, 2024 07:56
@Chisomchima Chisomchima requested a review from kabaros March 7, 2024 10:17
@dhis2-bot dhis2-bot temporarily deployed to netlify March 7, 2024 10:22 Inactive
@kabaros kabaros changed the base branch from master to alpha March 18, 2024 15:43
@@ -94,6 +113,8 @@ class SplitButton extends Component {
tabIndex={tabIndex}
className={cx(className, rightButton.className)}
dataTest={`${dataTest}-toggle`}
title="Toggle dropdown"
Copy link
Collaborator

Choose a reason for hiding this comment

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

use i18n for the labels

expect(getByText('Click me')).toBeInTheDocument()
})

it('toggles dropdown when right button is clicked', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's left button, not right?

Comment on lines 59 to 76
it("does not close dropdown 'SpaceBar' key is pressed", async () => {
const { getByTestId } = render(
<SplitButton component={<div>Dropdown Content</div>} />
)

const toggleButton = getByTestId('dhis2-uicore-splitbutton-toggle')
fireEvent.click(toggleButton)
expect(getByTestId('dhis2-uicore-splitbutton-menu')).toBeInTheDocument()

fireEvent.keyDown(document, { key: ' ' })

// Use waitFor to wait for the DOM to update
await waitFor(() => {
expect(
getByTestId('dhis2-uicore-splitbutton-menu')
).toBeInTheDocument()
})
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

one of these tests is enough (maybe remvoe the space bar one)

@dhis2-bot dhis2-bot temporarily deployed to netlify March 18, 2024 16:18 Inactive
@kabaros kabaros force-pushed the LIBS-566/splitButton-accessibility branch from f4c9bb9 to e1400a3 Compare March 18, 2024 16:29
@dhis2-bot dhis2-bot temporarily deployed to netlify March 19, 2024 13:56 Inactive
@kabaros kabaros merged commit 51a1b14 into alpha Mar 19, 2024
13 checks passed
@kabaros kabaros deleted the LIBS-566/splitButton-accessibility branch March 19, 2024 14:21
dhis2-bot added a commit that referenced this pull request Mar 19, 2024
# [9.5.0-alpha.1](v9.4.2...v9.5.0-alpha.1) (2024-03-19)

### Features

* splitButton accessibility improvements ([#1458](#1458)) ([51a1b14](51a1b14))
* **tooltip:** accessibility improvements for tooltip ([#1463](#1463)) ([f11eabb](f11eabb))
* add aria attributes to loaders ([#1449](#1449)) ([2832584](2832584))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 9.5.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

kabaros added a commit that referenced this pull request Jun 3, 2024
* feat: splitButton accessibility improvements

* feat: splitButton accessibility improvements

* feat: splitButton accessibility improvements

* refactor: apply code review comments (pairing session)

---------

Co-authored-by: Mozafar Haider <mozafar@dhis2.org>
dhis2-bot added a commit that referenced this pull request Jun 3, 2024
# [9.7.0](v9.6.0...v9.7.0) (2024-06-03)

### Bug Fixes

* **Tooltip:** add missing tabIndex ([389e61a](389e61a))

### Features

* splitButton accessibility improvements ([#1458](#1458)) ([8370915](8370915))
* **tooltip:** accessibility improvements for tooltip ([#1463](#1463)) ([9afcfdf](9afcfdf))
* add aria attributes to loaders ([#1449](#1449)) ([aaa60fb](aaa60fb))
* add optional aria-label prop to switch component ([bf9927a](bf9927a))
alaa-yahia pushed a commit that referenced this pull request Jun 10, 2024
* feat: splitButton accessibility improvements

* feat: splitButton accessibility improvements

* feat: splitButton accessibility improvements

* refactor: apply code review comments (pairing session)

---------

Co-authored-by: Mozafar Haider <mozafar@dhis2.org>
alaa-yahia pushed a commit that referenced this pull request Jun 10, 2024
* **Tooltip:** add missing tabIndex ([389e61a](389e61a))

* splitButton accessibility improvements ([#1458](#1458)) ([8370915](8370915))
* **tooltip:** accessibility improvements for tooltip ([#1463](#1463)) ([9afcfdf](9afcfdf))
* add aria attributes to loaders ([#1449](#1449)) ([aaa60fb](aaa60fb))
* add optional aria-label prop to switch component ([bf9927a](bf9927a))
dhis2-bot added a commit that referenced this pull request Jun 17, 2024
# [9.9.0-alpha.1](v9.8.1...v9.9.0-alpha.1) (2024-06-17)

### Features

* splitButton accessibility improvements ([#1458](#1458)) ([51a1b14](51a1b14))
* **tooltip:** accessibility improvements for tooltip ([#1463](#1463)) ([f11eabb](f11eabb))
* add aria attributes to loaders ([#1449](#1449)) ([2832584](2832584))

### Reverts

* Revert "feat(selectionBar): accessibility improvements for SelectionBar (#1475)" ([54498fb](54498fb)), closes [#1475](#1475)
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 9.9.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

dhis2-bot added a commit that referenced this pull request Sep 23, 2024
# [9.12.0-alpha.1](v9.11.4...v9.12.0-alpha.1) (2024-09-23)

### Bug Fixes

* bump multi calendar library version in calendar ([#1566](#1566)) ([d205016](d205016))
* bump multi calendar library version in calendar component  ([#1576](#1576)) ([5f2b13d](5f2b13d))
* update yarn.lock after deduping ([5c24b02](5c24b02))

### Features

* add aria attributes to loaders ([#1449](#1449)) ([2832584](2832584))
* memorize calendar container component to improve perfromance ([#1575](#1575)) ([0d00a19](0d00a19))
* merge master into alpha ([7afecf9](7afecf9))
* splitButton accessibility improvements ([#1458](#1458)) ([51a1b14](51a1b14))
* support editable input | min & max dates | dd-mm-yyyy format in CalendarInput ([#1504](#1504)) ([99a78f5](99a78f5))
* use alpha of multi calendar library ([0c6b966](0c6b966))
* verify date input only on blur on calendar input, close calendar popup on blur as well ([d8b0d1c](d8b0d1c))
* **tooltip:** accessibility improvements for tooltip ([#1463](#1463)) ([f11eabb](f11eabb))

### Reverts

* Revert "feat(selectionBar): accessibility improvements for SelectionBar (#1475)" ([54498fb](54498fb)), closes [#1475](#1475)
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 9.12.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants