-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs([DST-580]): Add page about accessibility (#4201)
* save * better * save * update * done! * add example for labeling * save * save * save * save * save * docs: Apply root styles to overlay portal so they are displayed correctly. * Create yellow-lies-bake.md * shorten * demo * save * feat(components): Mark layout coponents as regions for accessibility. * aria live demo * aria live demo * link up and list screenreaders * hiearchy * Fix code scanning alert no. 79: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * update * use mg components * format with jsx * use jsx comment * add badge * change intro --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2babc0b
commit e6861b2
Showing
25 changed files
with
606 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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 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
221 changes: 221 additions & 0 deletions
221
docs/content/foundations/accessibility/accessibility-aria-live.demo.tsx
This file contains 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,221 @@ | ||
import { useState } from 'react'; | ||
import { | ||
Aside, | ||
Button, | ||
Card, | ||
Columns, | ||
Form, | ||
Image, | ||
Inline, | ||
Menu, | ||
Select, | ||
Stack, | ||
Text, | ||
} from '@marigold/components'; | ||
import { NumericFormat } from '@marigold/system'; | ||
|
||
const locations = [ | ||
{ | ||
id: '1', | ||
name: 'The Giggle Grounds', | ||
type: 'Outdoor Amphitheater', | ||
description: | ||
'A charming open-air venue perfect for comedy shows under the stars, bringing laughter to every corner of Laughville.', | ||
street: '123 Main Street', | ||
city: 'Laughville', | ||
capacity: 500, | ||
price: { from: 1000, to: 5000 }, | ||
}, | ||
{ | ||
id: '2', | ||
name: 'The Wobbling Stage', | ||
type: 'Comedy Club', | ||
description: | ||
'An intimate comedy club with a quirky twist, where every joke makes the stage wobble with excitement!', | ||
street: '456 Comedy Boulevard', | ||
city: 'Shakytown', | ||
capacity: 300, | ||
price: { from: 750, to: 3500 }, | ||
}, | ||
{ | ||
id: '3', | ||
name: 'The Chuckle Barn', | ||
type: 'Converted Barn', | ||
description: | ||
'This rustic barn is now a cozy comedy haven—ideal for laughing till the cows come home!', | ||
street: '789 Oak Road', | ||
city: 'Hee-Haw City', | ||
capacity: 150, | ||
price: { from: 500, to: 2500 }, | ||
}, | ||
{ | ||
id: '4', | ||
name: 'The Quirky Quay', | ||
type: 'Waterfront Venue', | ||
description: | ||
'A scenic waterfront spot that blends quirky vibes and stunning views—perfect for a night full of smiles and sea breezes.', | ||
street: '101 Riverside Drive', | ||
city: 'Port Funsies', | ||
capacity: 600, | ||
price: { from: 2000, to: 7000 }, | ||
}, | ||
{ | ||
id: '5', | ||
name: 'The Hysterical Hive', | ||
type: 'Underground Lounge', | ||
description: | ||
'A buzzing underground lounge filled with laughter and good vibes, just like a hive full of joy.', | ||
street: '202 Buzzington Street', | ||
city: 'Buzzington', | ||
capacity: 250, | ||
price: { from: 1000, to: 4000 }, | ||
}, | ||
{ | ||
id: '6', | ||
name: 'The Belly Laugh Ballroom', | ||
type: 'Ballroom', | ||
description: | ||
'A grand ballroom where laughter echoes from every corner—guaranteed to make your belly ache from giggling.', | ||
street: '303 Grand Avenue', | ||
city: 'Giggleburg', | ||
capacity: 800, | ||
price: { from: 3000, to: 10000 }, | ||
}, | ||
{ | ||
id: '7', | ||
name: 'The Snicker Sanctuary', | ||
type: 'Theater', | ||
description: | ||
'A comfortable theater where all snickers, chuckles, and guffaws are welcome. Come find your happy place.', | ||
street: '404 Maple Court', | ||
city: 'Chortleton', | ||
capacity: 400, | ||
price: { from: 1500, to: 5000 }, | ||
}, | ||
{ | ||
id: '8', | ||
name: "The Jester's Junction", | ||
type: 'Community Center', | ||
description: | ||
'A vibrant community center with fun-loving vibes and plenty of laughter—where every visitor is treated like royalty!', | ||
street: '505 Broadway Boulevard', | ||
city: 'Merrymouth', | ||
capacity: 350, | ||
price: { from: 1200, to: 4500 }, | ||
}, | ||
{ | ||
id: '9', | ||
name: 'The Punning Pavilion', | ||
type: 'Open Pavilion', | ||
description: | ||
'An open pavilion designed for wordplay wizards and pun enthusiasts—come enjoy a night of laughter that hits all the right notes.', | ||
street: '606 Hillcrest Way', | ||
city: 'Wordplay Heights', | ||
capacity: 450, | ||
price: { from: 1800, to: 5500 }, | ||
}, | ||
{ | ||
id: '10', | ||
name: 'The Guffaw Gardens', | ||
type: 'Botanical Garden', | ||
description: | ||
'A beautiful garden that blooms with laughter—ideal for large gatherings filled with smiles and fresh air.', | ||
street: '707 Bloomfield Road', | ||
city: 'Laughterfield', | ||
capacity: 1000, | ||
price: { from: 4000, to: 12000 }, | ||
}, | ||
]; | ||
export default () => { | ||
const [selectedLocation, setSelectedLocation] = useState(locations[0].id); | ||
const current = locations.find(location => location.id === selectedLocation)!; | ||
|
||
return ( | ||
<Stack space={4}> | ||
<Form | ||
onSubmit={e => { | ||
e.preventDefault(); | ||
const form = new FormData(e.currentTarget); | ||
const location = form.get('location')!; | ||
setSelectedLocation(location.toString()); | ||
}} | ||
> | ||
<Inline space={2}> | ||
<Select | ||
aria-label="Select a location:" | ||
name="location" | ||
width={48} | ||
defaultSelectedKey={selectedLocation} | ||
> | ||
{locations.map(location => ( | ||
<Select.Option key={location.id} id={location.id}> | ||
{location.name} | ||
</Select.Option> | ||
))} | ||
</Select> | ||
<Button | ||
variant="primary" | ||
type="submit" | ||
aria-controls="locationDetails" | ||
> | ||
View details | ||
</Button> | ||
</Inline> | ||
</Form> | ||
<Card px={4} py={6}> | ||
<Aside sideWidth="160px" space={8}> | ||
<Image | ||
alt="" | ||
src={`/venues/${current.name.toLocaleLowerCase().replaceAll(' ', '-').replace(/'/g, '')}.webp`} | ||
/> | ||
<Stack | ||
space={6} | ||
id="locationDetails" | ||
role="region" | ||
aria-live="polite" | ||
> | ||
<Stack> | ||
<Text id="locationName" weight="extrabold" fontSize="2xl"> | ||
{current.name} | ||
</Text> | ||
<Text fontStyle="italic">{current.type}</Text> | ||
</Stack> | ||
<Stack> | ||
<Text weight="bold">Description</Text> | ||
<Text>{current.description}</Text> | ||
</Stack> | ||
<Columns columns={[1, 1, 1]} space={4}> | ||
<Stack> | ||
<Text weight="bold">Address</Text> | ||
<Text>{current.street}</Text> | ||
<Text>{current.city}</Text> | ||
</Stack> | ||
<Stack> | ||
<Text weight="bold">Capacity</Text> | ||
<Text>{current.capacity}</Text> | ||
</Stack> | ||
<Stack> | ||
<Text weight="bold">Price</Text> | ||
<Text> | ||
<NumericFormat | ||
style="currency" | ||
value={current.price.from} | ||
currency="EUR" | ||
notation="compact" | ||
/>{' '} | ||
to{' '} | ||
<NumericFormat | ||
style="currency" | ||
value={current.price.to} | ||
currency="EUR" | ||
notation="compact" | ||
/> | ||
</Text> | ||
</Stack> | ||
</Columns> | ||
</Stack> | ||
</Aside> | ||
</Card> | ||
</Stack> | ||
); | ||
}; |
43 changes: 43 additions & 0 deletions
43
docs/content/foundations/accessibility/accessibility-focus.demo.tsx
This file contains 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,43 @@ | ||
import { | ||
Button, | ||
Center, | ||
Checkbox, | ||
Dialog, | ||
Headline, | ||
Inline, | ||
Stack, | ||
} from '@marigold/components'; | ||
|
||
export default () => ( | ||
<Center> | ||
<Dialog.Trigger> | ||
<Button variant="primary">Open notification settings</Button> | ||
<Dialog closeButton> | ||
{({ close }) => ( | ||
<> | ||
<Headline id="dialog-headline" level={2}> | ||
Notification settings | ||
</Headline> | ||
<Stack space={4}> | ||
<Checkbox.Group aria-labelledby="dialog-headline"> | ||
<Checkbox value="newsletter" defaultChecked> | ||
Email Newsletter | ||
</Checkbox> | ||
<Checkbox value="reminder">Event Reminders</Checkbox> | ||
<Checkbox value="promo">Promo Notifications</Checkbox> | ||
</Checkbox.Group> | ||
<Inline space={4}> | ||
<Button variant="primary" onPress={close}> | ||
Update | ||
</Button> | ||
<Button variant="secondary" onPress={close}> | ||
Cancel | ||
</Button> | ||
</Inline> | ||
</Stack> | ||
</> | ||
)} | ||
</Dialog> | ||
</Dialog.Trigger> | ||
</Center> | ||
); |
Oops, something went wrong.