-
Notifications
You must be signed in to change notification settings - Fork 17
feat(Row): Row switch announces when it has expanded content #1462
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
Open
AlexandraGallipoliRodrigues
wants to merge
10
commits into
master
Choose a base branch
from
row-switch-announces-when-it-has-expanded-content
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
263c87f
row-switch-announces-when-it-has-expanded-content
AlexandraGallipoliRodrigues 592463f
translated comments
AlexandraGallipoliRodrigues 00ccb52
modified aria-atomic
AlexandraGallipoliRodrigues a2f065b
WEB-2283: replaced literal with a token
AlexandraGallipoliRodrigues 5e63e6b
Merge branch 'master' into row-switch-announces-when-it-has-expanded-…
AlexandraGallipoliRodrigues b5821ef
PR changes
AlexandraGallipoliRodrigues e57dbb6
Merge branch 'master' of github.com:Telefonica/mistica-web into row-s…
AlexandraGallipoliRodrigues b5e21c5
minor changes
AlexandraGallipoliRodrigues c197544
added private list-disclosure-story
AlexandraGallipoliRodrigues 29943be
deleted aria-expanded and aria-controls from rows
AlexandraGallipoliRodrigues File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| Box, | ||
| Stack, | ||
| Row, | ||
| RowList, | ||
| RadioGroup, | ||
| NegativeBox, | ||
| ResponsiveLayout, | ||
| Title3, | ||
| Text3, | ||
| IconShopRegular, | ||
| } from '..'; | ||
|
|
||
| export default { | ||
| title: 'Private/Lists/ControlDisclosure', | ||
| parameters: { | ||
| fullScreen: true, | ||
| }, | ||
| }; | ||
|
|
||
| export const ControlDisclosureExample: StoryComponent = () => { | ||
| // Example state for the radio rows | ||
| const [fruit, setFruit] = React.useState<'banana' | 'apple'>('banana'); | ||
|
|
||
| // Example state for switch + checkbox rows | ||
| const [switchA, setSwitchA] = React.useState(false); | ||
| const [checkboxB, setCheckboxB] = React.useState(false); | ||
|
|
||
| return ( | ||
| <Box paddingY={24}> | ||
| <ResponsiveLayout> | ||
| <Stack space={32}> | ||
| {/* Example 1: Radio rows that expand additional content */} | ||
| <Stack space={16}> | ||
| <Title3 as="h1">Radio rows with expandable content</Title3> | ||
|
|
||
| <RadioGroup | ||
| name="fruit" | ||
| value={fruit} | ||
| onChange={(value) => setFruit(value as 'banana' | 'apple')} | ||
| > | ||
| <RowList> | ||
| <Row | ||
| asset={<IconShopRegular />} | ||
| title="Banana" | ||
| description="Yellow" | ||
| radioValue="banana" | ||
| radio={{ | ||
| controlDisclosure: { | ||
| expanded: fruit === 'banana', | ||
| 'aria-live': 'assertive', | ||
| }, | ||
| }} | ||
| /> | ||
|
|
||
| <Row | ||
| asset={<IconShopRegular />} | ||
| title="Apple" | ||
| description="Green" | ||
| radioValue="apple" | ||
| radio={{ | ||
| controlDisclosure: { | ||
| expanded: fruit === 'apple', | ||
| 'aria-live': 'assertive', | ||
| }, | ||
| }} | ||
| /> | ||
| </RowList> | ||
| </RadioGroup> | ||
|
|
||
| {fruit === 'banana' && ( | ||
| <Box id="panel-banana" paddingLeft={16}> | ||
| <Stack space={8}> | ||
| <Title3 as="h1">Additional options for BANANA</Title3> | ||
| <Text3 light> | ||
| Example content for Banana. Use this section to validate that the | ||
| radio row triggers the correct ARIA announcements and expansion | ||
| behaviour. | ||
| </Text3> | ||
| </Stack> | ||
| </Box> | ||
| )} | ||
|
|
||
| {fruit === 'apple' && ( | ||
| <Box id="panel-apple" paddingLeft={16}> | ||
| <Stack space={8}> | ||
| <Title3 as="h1">Additional options for APPLE</Title3> | ||
| <Text3 light> | ||
| Example content for Apple. Expands when the corresponding radio row is | ||
| selected. | ||
| </Text3> | ||
| </Stack> | ||
| </Box> | ||
| )} | ||
| </Stack> | ||
| {/* Example 2: Switch / Checkbox rows that expand */} | ||
| <Stack space={16}> | ||
| <Title3 as="h2">Switch and checkbox rows with expandable content</Title3> | ||
|
|
||
| <NegativeBox> | ||
| <RowList> | ||
| <Row | ||
| title="Call forwarding A" | ||
| description="Additional options appear when enabled." | ||
| switch={{ | ||
| name: 'switch-a', | ||
| value: switchA, | ||
| onChange: setSwitchA, | ||
| controlDisclosure: { | ||
| expanded: switchA, | ||
| 'aria-live': 'assertive', | ||
| onLabelWhenExpanded: 'Options available below.', | ||
| }, | ||
| }} | ||
| /> | ||
|
|
||
| <Row | ||
| title="Call forwarding B" | ||
| description="Another example of expandable content." | ||
| checkbox={{ | ||
| name: 'checkbox-b', | ||
| value: checkboxB, | ||
| onChange: setCheckboxB, | ||
| controlDisclosure: { | ||
| expanded: checkboxB, | ||
| 'aria-live': 'assertive', | ||
| onLabelWhenExpanded: 'Options available below.', | ||
| }, | ||
| }} | ||
| /> | ||
| </RowList> | ||
| </NegativeBox> | ||
|
|
||
| {switchA && ( | ||
| <Box id="switch-a-panel" paddingLeft={16}> | ||
| <Stack space={8}> | ||
| <Title3 as="h1">Extra options for A</Title3> | ||
| <Text3 light> | ||
| This section becomes visible when the switch is active. Used to | ||
| validate accessibility announcements for switch-based disclosure. | ||
| </Text3> | ||
| </Stack> | ||
| </Box> | ||
| )} | ||
|
|
||
| {checkboxB && ( | ||
| <Box id="switch-b-panel" paddingLeft={16}> | ||
| <Stack space={8}> | ||
| <Title3 as="h1">Extra options for B</Title3> | ||
| <Text3 light> | ||
| Example content for the checkbox row. Helpful to test both visual and | ||
| screen-reader behaviour. | ||
| </Text3> | ||
| </Stack> | ||
| </Box> | ||
| )} | ||
| </Stack> | ||
| </Stack> | ||
| </ResponsiveLayout> | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| ControlDisclosureExample.storyName = 'ControlDisclosure'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
|| undefinedto conditionally render the attribute is unnecessary. The aria-busy attribute should be explicitly set to 'true' or 'false' as a string, or omitted entirely. Usearia-busy={rowIsBusy ? 'true' : undefined}oraria-busy={rowIsBusy ? true : undefined}instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought is a type Booleanish = boolean | 'true' | 'false'; so booleans are also valid, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so