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
docs(color-loupe): update README for clarity and structure (#5700)
* docs(color-loupe): update README for clarity and structure
* docs(color-loupe): enhance README with accessibility details and touch interaction improvements
* docs(color-loupe): expand README with new tabbed interface examples for color selection components
An `<sp-color-loupe>` shows the output color that would otherwise be covered by a cursor, stylus, or finger during color selection.
4
4
@@ -7,23 +7,28 @@ An `<sp-color-loupe>` shows the output color that would otherwise be covered by
7
7
[](https://www.npmjs.com/package/@spectrum-web-components/color-loupe)
8
8
[](https://bundlephobia.com/result?p=@spectrum-web-components/color-loupe)
9
9
10
-
```
10
+
```bash
11
11
yarn add @spectrum-web-components/color-loupe
12
12
```
13
13
14
14
Import the side effectful registration of `<sp-color-loupe>` via:
- A floating loupe element positioned above the interaction point
31
+
- A color preview that reflects the color currently sampled by its parent color component
27
32
28
33
```html
29
34
<divstyle="padding: 100px00;">
@@ -32,3 +37,193 @@ import { ColorLoupe } from '@spectrum-web-components/color-loupe';
32
37
</div>
33
38
</div>
34
39
```
40
+
41
+
### Options
42
+
43
+
#### Color
44
+
45
+
The color property sets the visual color displayed within the loupe. This accepts any valid CSS color format.
46
+
47
+
For a complete list of supported color formats, see the [ColorController documentation](/tools/color-controller#supported-color-formats).
48
+
49
+
Transparency Support: When using transparent colors, the handle displays an opacity checkerboard pattern background to clearly show the transparency level.
The color loupe is typically managed by its parent color component (such as `<sp-color-area>`, `<sp-color-slider>`, or `<sp-color-wheel>`). The loupe automatically appears when the user interacts with the parent component and disappears when the interaction ends.
126
+
127
+
#### Automatic behavior
128
+
129
+
-**Touch input**: The loupe automatically appears during touch interactions with any color component (`<sp-color-area>`, `<sp-color-slider>`, or `<sp-color-wheel>`) to prevent the finger from obscuring the selected color
130
+
-**Mouse/Stylus input**: The loupe remains hidden by default for precision pointing devices
131
+
-**Parent control**: The loupe's visibility is managed by the parent color component
132
+
-**Accessibility**: The loupe ensures that users can see the selected color even when their finger covers the interaction point
133
+
134
+
### Accessibility
135
+
136
+
The `<sp-color-loupe>` is designed to work as part of accessible color selection components. The loupe automatically appears during touch interactions with any of these components to ensure the selected color remains visible:
aria-label="Color wheel - select from the full color spectrum"
178
+
aria-describedby="color-context"
179
+
></sp-color-wheel>
180
+
</div>
181
+
```
182
+
183
+
</sp-tab-panel>
184
+
</sp-tabs>
185
+
186
+
#### Screen reader support
187
+
188
+
The color loupe is rendered as a visual indicator and does not directly interface with screen readers. Accessibility is provided through the parent color component's ARIA implementation.
189
+
190
+
#### Focus management
191
+
192
+
Focus is managed by the parent color component, with the loupe reflecting the focused state visually when its parent component has keyboard focus.
193
+
194
+
#### Touch accessibility
195
+
196
+
-**Automatic loupe display**: During touch interactions with any color component, the loupe automatically appears to ensure the selected color remains visible
197
+
-**Finger coverage prevention**: The loupe prevents the user's finger from obscuring the color they're selecting
198
+
-**Touch interaction support**: Color components support touch interactions with proper pointer event handling
199
+
-**Visual feedback**: The loupe provides immediate visual feedback during touch interactions
200
+
201
+
#### Best practices
202
+
203
+
- Ensure the parent color component (for example, `sp-color-area`, `sp-color-slider`, or `sp-color-wheel`) provides appropriate labeling via visible text or ARIA
204
+
- Avoid conveying meaning through color alone; pair color with text, labels, or other indicators as appropriate
205
+
- The loupe is visual-only and should not receive focus. Manage focus on the interactive parent control
206
+
- Test touch interactions on mobile devices to ensure the loupe appears correctly and provides adequate visual feedback
207
+
208
+
#### Accessible example
209
+
210
+
Provide clear context for what the loupe displays. The loupe itself is presentational and is typically managed by its parent color component. During touch interactions, the loupe automatically appears to ensure the selected color remains visible. The loupe is a visual-only element and doesn't require ARIA attributes since it doesn't provide interactive functionality.
0 commit comments