From b5123c6b7cdcd2894837b8f1898f8d84d1da3b74 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Wed, 8 Jan 2025 12:29:31 +0000 Subject: [PATCH 1/2] fix(a11y): user select menu labels - fix 'Selected: [object Object]' in the labels for user dropdown menus. - add plain English labels for the project and date range menus. --- .../src/components/shared/MainContent/MainContent.js | 2 ++ .../components/shared/MainContent/MainContent.spec.js | 9 +++++++-- packages/lib-user/src/components/shared/Select/Select.js | 8 +++++--- packages/lib-user/src/translations/en.json | 2 ++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/lib-user/src/components/shared/MainContent/MainContent.js b/packages/lib-user/src/components/shared/MainContent/MainContent.js index 9827887032..807c650c19 100644 --- a/packages/lib-user/src/components/shared/MainContent/MainContent.js +++ b/packages/lib-user/src/components/shared/MainContent/MainContent.js @@ -212,6 +212,7 @@ function MainContent({ diff --git a/packages/lib-user/src/components/shared/GroupForm/GroupForm.spec.js b/packages/lib-user/src/components/shared/GroupForm/GroupForm.spec.js index f7b312d224..8579112dde 100644 --- a/packages/lib-user/src/components/shared/GroupForm/GroupForm.spec.js +++ b/packages/lib-user/src/components/shared/GroupForm/GroupForm.spec.js @@ -37,7 +37,7 @@ describe('components > shared > GroupForm', function() { render() // the Grommet Select component renders as a button with a textbox. The statsVisibility input uses the Grommet Select, therefore we need to find the textbox role. The textbox name includes the value of the select, which by default is 'private_agg_only'. - const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, private_agg_only' }) + const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, No, don\'t show individual stats to members' }) expect(statsVisibility).to.be.ok() }) @@ -49,7 +49,7 @@ describe('components > shared > GroupForm', function() { const privateRadio = screen.getByRole('radio', { name: 'Private - only members can view this group' }) expect(privateRadio.checked).to.be.true() - const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, private_agg_only' }) + const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, No, don\'t show individual stats to members' }) await user.click(statsVisibility) const options = screen.getAllByRole('option') @@ -67,7 +67,7 @@ describe('components > shared > GroupForm', function() { await user.click(publicRadio) expect(publicRadio.checked).to.be.true() - const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, public_agg_only' }) + const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, No, never show individual stats' }) await user.click(statsVisibility) const options = screen.getAllByRole('option') @@ -148,7 +148,7 @@ describe('components > shared > GroupForm', function() { it('should show the group stats visibility', function() { render() - const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, public_show_all' }) + const statsVisibility = screen.getByRole('textbox', { name: 'Stats Visibility, Yes, always show individual stats' }) expect(statsVisibility).to.be.ok() }) })