You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/tray/README.md
+59-4Lines changed: 59 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,9 +71,9 @@ A tray has a single default `slot`.
71
71
72
72
`<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.
73
73
74
-
#### Mobile screen reader support
74
+
#### Auto-detection behavior
75
75
76
-
The `<sp-tray>`component automatically includes visually hidden dismiss buttons before and after its content to support mobile screen readers. This is particularly important for VoiceOver on iOS, where users navigate through interactive elements sequentially.
76
+
By default, `<sp-tray>` automatically detects whether its slotted content includes keyboard-accessible dismiss buttons (like `<sp-button>`, `<sp-close-button>`, or HTML `<button>` elements). When no dismiss buttons are found, the tray renders visually hidden dismiss buttons before and after its content to support mobile screen readers, particularly VoiceOver on iOS where users navigate through interactive elements sequentially.
77
77
78
78
These built-in dismiss buttons:
79
79
@@ -84,7 +84,11 @@ These built-in dismiss buttons:
84
84
85
85
This dismiss helper pattern is also implemented in the [`<sp-picker>`](https://opensource.adobe.com/spectrum-web-components/components/picker/) component, which uses the same approach when rendering menu content in a tray on mobile devices.
86
86
87
-
Simply place your content inside the tray - the dismiss buttons are automatically rendered:
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."
88
92
89
93
```html
90
94
<overlay-triggertype="modal">
@@ -100,16 +104,67 @@ Simply place your content inside the tray - the dismiss buttons are automaticall
100
104
</sp-menu>
101
105
</sp-tray>
102
106
</overlay-trigger>
107
+
```
108
+
109
+
</sp-tab-panel>
110
+
<sp-tabvalue="with-buttons">Content has buttons</sp-tab>
111
+
<sp-tab-panelvalue="with-buttons">
112
+
113
+
This example shows auto-detection recognizing that the dialog has its own dismiss functionality, so no additional helpers are rendered:
Set `has-keyboard-dismiss` (or `has-keyboard-dismiss="true"`) to prevent the tray from rendering visually hidden dismiss helpers, even when no buttons are detected. This tells the tray that your content already has keyboard-accessible dismiss functionality.
0 commit comments