Skip to content

Commit 8a00f23

Browse files
docs(tray): replace menu examples with more appropriate content (#5888)
1 parent e780f82 commit 8a00f23

File tree

1 file changed

+25
-38
lines changed

1 file changed

+25
-38
lines changed

1st-gen/packages/tray/README.md

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ import { Tray } from '@spectrum-web-components/tray';
2525

2626
### Anatomy
2727

28-
A tray has a single default `slot`.
29-
30-
<sp-tabs selected="dialog" auto label="Using tray's slot">
31-
<sp-tab value="dialog">Dialog</sp-tab>
32-
<sp-tab-panel value="dialog">
28+
A tray has a single default `slot`. Expected content typically includes dialogs and their content, plain text, forms and/or form elements, and some native HTML elements. Always ensure that your tray's content is accessible according to WCAG standards.
3329

3430
```html
3531
<overlay-trigger type="modal">
@@ -43,30 +39,6 @@ A tray has a single default `slot`.
4339
</overlay-trigger>
4440
```
4541

46-
</sp-tab-panel>
47-
<sp-tab value="menu">Menu</sp-tab>
48-
<sp-tab-panel value="menu">
49-
50-
```html
51-
<overlay-trigger type="modal">
52-
<sp-button slot="trigger" variant="secondary">Toggle menu</sp-button>
53-
<sp-tray slot="click-content">
54-
<sp-menu style="width: 100%">
55-
<sp-menu-item selected>Deselect</sp-menu-item>
56-
<sp-menu-item>Select Inverse</sp-menu-item>
57-
<sp-menu-item focused>Feather...</sp-menu-item>
58-
<sp-menu-item>Select and Mask...</sp-menu-item>
59-
<sp-menu-divider></sp-menu-divider>
60-
<sp-menu-item>Save Selection</sp-menu-item>
61-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
62-
</sp-menu>
63-
</sp-tray>
64-
</overlay-trigger>
65-
```
66-
67-
</sp-tab-panel>
68-
</sp-tabs>
69-
7042
### Accessibility
7143

7244
`<sp-tray>` presents a page blocking experience and should be opened with the `Overlay` API using the `modal` interaction to ensure that the content appropriately manages the presence of other content in the tab order of the page and the availability of that content for a screen reader.
@@ -87,20 +59,35 @@ This dismiss helper pattern is also implemented in the [`<sp-picker>`](https://o
8759
<sp-tab value="auto">Content has no buttons</sp-tab>
8860
<sp-tab-panel value="auto">
8961

90-
This example shows the default behavior where the tray automatically detects that the menu content lacks dismiss buttons and renders visually hidden helpers. Screen readers will announce them as "Dismiss, button" and these helpers are keyboard accessible.
62+
This example shows the default behavior where the tray automatically detects that the content lacks dismiss buttons and renders visually hidden helpers. Screen readers will announce them as "Dismiss, button" and these helpers are keyboard accessible.
9163

9264
```html
9365
<overlay-trigger type="modal">
9466
<sp-button slot="trigger" variant="secondary">
95-
Toggle menu content
67+
Toggle tray content
9668
</sp-button>
9769
<sp-tray slot="click-content">
98-
<sp-menu style="width: 100%">
99-
<sp-menu-item>Deselect</sp-menu-item>
100-
<sp-menu-item>Select Inverse</sp-menu-item>
101-
<sp-menu-item>Feather...</sp-menu-item>
102-
<sp-menu-item>Select and Mask...</sp-menu-item>
103-
</sp-menu>
70+
<div style="display: flex; flex-direction: column; margin: 16px;">
71+
<p style="margin-block-start: 0;">
72+
Custom content that doesn't have dismiss functionality, so the
73+
tray detects it needs the visually-hidden dismiss buttons.
74+
</p>
75+
<label>
76+
What's your favorite Super Mario character?
77+
<select
78+
name="favorite-characters"
79+
style="margin-block-start: 8px;"
80+
>
81+
<option value="">
82+
Choose your favorite Super Mario character.
83+
</option>
84+
<option value="mario">Mario</option>
85+
<option value="luigi">Luigi</option>
86+
<option value="toad">Toad</option>
87+
<option value="bowser">Bowser</option>
88+
</select>
89+
</label>
90+
</div>
10491
</sp-tray>
10592
</overlay-trigger>
10693
```
@@ -137,7 +124,7 @@ Set `has-keyboard-dismiss` (or `has-keyboard-dismiss="true"`) to prevent the tra
137124
Toggle without helpers
138125
</sp-button>
139126
<sp-tray slot="click-content" has-keyboard-dismiss>
140-
<p>
127+
<p style="margin: 16px;">
141128
Custom content that should have custom dismiss functionality, even
142129
though the tray didn't detect buttons in this slot.
143130
</p>

0 commit comments

Comments
 (0)