Skip to content

Commit

Permalink
Additional docs
Browse files Browse the repository at this point in the history
  • Loading branch information
filoxo committed Aug 13, 2024
1 parent 94c91bb commit 0bd9004
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
18 changes: 17 additions & 1 deletion src/Accordion/Accordion.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,23 @@ export const Default: Story<AccordionProps> = () => {
HTML Details element
</a>
. Some UI requirements, like that in the <em>custom trigger</em> story,
make a custom implementation necessary.
make a custom implementation necessary. Even a requirement as simple as
"animate in/out" might require this.
</p>
<p>
See also:
<ul>
<li>
<a href="https://www.w3.org/TR/wai-aria-practices-1.2/#accordion">
WAI-ARIA Accordion Pattern
</a>
</li>
<li>
<a href="https://www.w3.org/TR/wai-aria-practices-1.2/#disclosure">
WAI-ARIA Disclosure Pattern
</a>
</li>
</ul>
</p>
<Accordion>
<AccordionItemGroup>
Expand Down
39 changes: 32 additions & 7 deletions src/Autocomplete/Autocomplete.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
import type { StoryDefault, Story } from "@ladle/react";
import type { StoryDefault, Story } from "@ladle/react"

import { Autocomplete, type AutocompleteProps } from "./Autocomplete";
import { AutocompleteOption } from "./AutocompleteOption";
import { useState } from "react";
import { Autocomplete, type AutocompleteProps } from "./Autocomplete"
import { AutocompleteOption } from "./AutocompleteOption"
import { useState } from "react"

export default {
args: {
autoExpand: true,
},
} satisfies StoryDefault<AutocompleteProps>;
} satisfies StoryDefault<AutocompleteProps>

export const Default: Story<AutocompleteProps> = () => {
const [displayValue, setDisplayValue] = useState("");
const [displayValue, setDisplayValue] = useState("")
return (
<div style={{ minHeight: 250 }}>
<p>
This Autocomplete was built with the assumption that it might not know
what its "options" might look like. Specifically, the use case was to
allow for Design/UX to be able to have full flexibility the way the
option displayed, as long as the action specified a value on the
MenuItem.
</p>
<p>
This implementation also makes use of <code>aria-activedescendant</code>
, per{" "}
<a href="https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant">
WAI-ARIA "Managing Focus in Composites Using aria-activedescendant"
</a>
.
</p>
<p>
See also:
<ul>
<li>
<a href="https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/">
WAI-ARIA Combobox Example
</a>
</li>
</ul>
</p>
<label htmlFor="demo">Select an option</label>
<Autocomplete
id="demo"
Expand Down Expand Up @@ -44,4 +69,4 @@ export const Default: Story<AutocompleteProps> = () => {
</Autocomplete>
</div>
)
};
}

0 comments on commit 0bd9004

Please sign in to comment.