-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17989 from storybookjs/jsomsanith/fix/a11y_elemen…
…t_id fix(#16232): use a11y params > element properly
- Loading branch information
Showing
2 changed files
with
41 additions
and
7 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
38 changes: 38 additions & 0 deletions
38
examples/official-storybook/stories/addon-a11y/parameters.stories.js
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,38 @@ | ||
import React from 'react'; | ||
import BaseButton from '../../components/BaseButton'; | ||
|
||
export default { | ||
title: 'Addons/A11y/Parameters', | ||
component: BaseButton, | ||
parameters: { | ||
options: { selectedPanel: 'storybook/a11y/panel' }, | ||
}, | ||
}; | ||
|
||
export const ElementId = () => ( | ||
<> | ||
<p> | ||
The <code>a11y.element</code> parameter is set to the <strong>Insufficient contrast</strong>{' '} | ||
section.{' '} | ||
</p> | ||
|
||
<div id="no-text" style={{ border: '1px solid gray', padding: '1rem', marginBottom: '1rem' }}> | ||
<strong>No discernable button text</strong> | ||
<p>This a11y violation should not be reported, as this section is not scanned.</p> | ||
<BaseButton label="" /> | ||
</div> | ||
<div id="insufficient-contrast" style={{ border: '1px solid gray', padding: '1rem' }}> | ||
<strong>Insufficient contrast</strong> | ||
<p>This a11y issue (incomplete) should be reported.</p> | ||
<BaseButton | ||
style={{ color: 'black', backgroundColor: 'black' }} | ||
label="Insufficient contrast" | ||
/> | ||
</div> | ||
</> | ||
); | ||
ElementId.parameters = { | ||
a11y: { | ||
element: '#insufficient-contrast', | ||
}, | ||
}; |