Skip to content

Commit d922d70

Browse files
authored
Merge branch 'main' into rajdeep/SWC-1018
2 parents df51141 + f27ab09 commit d922d70

File tree

25 files changed

+1246
-216
lines changed

25 files changed

+1246
-216
lines changed

.changeset/fix-color-wheel-step.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@spectrum-web-components/color-wheel': patch
3+
---
4+
5+
Fixed `<sp-color-wheel>` step attribute functionality for keyboard navigation. The step attribute now properly controls the increment size when using arrow keys to navigate the color wheel.

.changeset/four-lions-enjoy.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@spectrum-web-components/menu': minor
3+
---
4+
5+
**Fixed** : Fix iPad scrolling issue in picker dropdown where scrolling through menu items would accidentally select the first touched item and close the picker.
6+
7+
The fix implements touch gesture detection to distinguish between scrolling and selection. Added `isScrolling` getter for public API access. Test on iPad devices with long menus to validate scrolling behavior and selection accuracy.

.changeset/plenty-eyes-mate.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@spectrum-web-components/contextual-help': patch
3+
---
4+
5+
Fixed a typo in the default `info` variant label from "Informations" to "Information".
6+
7+
Additionally, added package dependency for `@spectrum-web-components/[email protected]`.

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ parameters:
2222
# 3. Commit this change to the PR branch where the changes exist.
2323
current_golden_images_hash:
2424
type: string
25-
default: dd2217ab088b6a78c6d95aa4751396726f24fa0f
25+
default: e919c253a7cb75ee16c0ef680b50a032236f7275
2626
wireit_cache_name:
2727
type: string
2828
default: wireit

.eslintrc.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
"extends": ["plugin:jsonc/recommended-with-jsonc"],
1717
"files": ["*.json"],
1818
"parser": "jsonc-eslint-parser",
19+
"rules": {
20+
"jsonc/sort-keys": ["warn"],
21+
"notice/notice": "off"
22+
}
23+
},
24+
{
25+
"extends": ["plugin:jsonc/recommended-with-jsonc"],
26+
"files": ["package.json"],
27+
"parser": "jsonc-eslint-parser",
1928
"rules": {
2029
"jsonc/sort-keys": [
2130
"warn",
@@ -65,14 +74,18 @@
6574
"cpu",
6675
"publishConfig"
6776
],
68-
"pathPattern": ".*" // Hits the all properties
77+
"pathPattern": "^$" // Top-level properties
6978
},
7079
{
80+
/*
81+
* This rule excludes export conditions from alphabetical sorting.
82+
* Since node.js processes export conditions in order and chooses the
83+
* first match, they need to be ordered logically, not alphabetically.
84+
*/
7185
"order": { "type": "asc" },
72-
"pathPattern": ".*"
86+
"pathPattern": "^(?!exports\\[).*" // All properties except export conditions
7387
}
74-
],
75-
"notice/notice": "off"
88+
]
7689
}
7790
},
7891
{

packages/.eslintrc.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@
134134
"extends": ["plugin:jsonc/recommended-with-jsonc"],
135135
"files": ["*.json"],
136136
"parser": "jsonc-eslint-parser",
137+
"rules": {
138+
"jsonc/sort-keys": ["warn"],
139+
"notice/notice": "off"
140+
}
141+
},
142+
{
143+
"extends": ["plugin:jsonc/recommended-with-jsonc"],
144+
"files": ["package.json"],
145+
"parser": "jsonc-eslint-parser",
137146
"rules": {
138147
"jsonc/sort-keys": [
139148
"warn",
@@ -183,14 +192,18 @@
183192
"cpu",
184193
"publishConfig"
185194
],
186-
"pathPattern": ".*" // Hits the all properties
195+
"pathPattern": "^$" // Top-level properties
187196
},
188197
{
198+
/*
199+
* This rule excludes export conditions from alphabetical sorting.
200+
* Since node.js processes export conditions in order and chooses the
201+
* first match, they need to be ordered logically, not alphabetically.
202+
*/
189203
"order": { "type": "asc" },
190-
"pathPattern": ".*"
204+
"pathPattern": "^(?!exports\\[).*" // All properties except export conditions
191205
}
192-
],
193-
"notice/notice": "off"
206+
]
194207
}
195208
}
196209
]

packages/avatar/README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
## Description
1+
## Overview
22

3-
An `<sp-avatar>` is a great way to feature a visual representation of a user.
3+
An `<sp-avatar>` is a thumbnail representation of an entity, such as a user or an organization. Avatars can have a defined image, which is usually uploaded by a user.
4+
5+
[View the design documentation for this component.](https://spectrum.adobe.com/page/avatar/)
46

57
### Usage
68

79
[![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/avatar?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/avatar)
810
[![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/avatar?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/avatar)
911
[![Try it on Stackblitz](https://img.shields.io/badge/Try%20it%20on-Stackblitz-blue?style=for-the-badge)](https://stackblitz.com/edit/vitejs-vite-swzc3ix8)
1012

11-
```
13+
```zsh
1214
yarn add @spectrum-web-components/avatar
1315
```
1416

1517
Import the side effectful registration of `<sp-avatar>` via:
1618

17-
```
19+
```js
1820
import '@spectrum-web-components/avatar/sp-avatar.js';
1921
```
2022

2123
When looking to leverage the `Avatar` base class as a type and/or for extension purposes, do so via:
2224

23-
```
25+
```js
2426
import { Avatar } from '@spectrum-web-components/avatar';
2527
```
2628

27-
## Sizes
29+
### Options
30+
31+
#### Sizes
32+
33+
Avatar sizes scale exponentially, based on the Spectrum type scale. These range from `size-50` to `size-700`. An avatar can also be customized to fit appropriately for your context. The default size is `size-100`.
2834

2935
<sp-tabs selected="100" auto label="Size Attribute Options">
3036
<sp-tab value="50">50</sp-tab>
@@ -137,6 +143,16 @@ import { Avatar } from '@spectrum-web-components/avatar';
137143
</sp-tab-panel>
138144
</sp-tabs>
139145

140-
## Accessibility
146+
### States
147+
148+
#### Generic avatars
149+
150+
Use branded generic avatars when a user has not set their avatar image. These images are designed to be abstracted from all genders, locales, and cultures.
151+
152+
#### Disabled
153+
154+
An avatar in a disabled state shows that an avatar exists, but is not available or a user is not active in that circumstance. This can be used to maintain layout continuity and communicate that an avatar may become available or active later.
155+
156+
### Accessibility
141157

142158
The `label` attribute of the `<sp-avatar>` will be passed into the `<img>` element as the `alt` tag for use in defining a textual representation of the image displayed.

packages/color-handle/README.md

Lines changed: 128 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,164 @@
1-
## Description
1+
## Overview
22

3-
The `<sp-color-handle>` is used to select a colour on an `<sp-color-area>`, `<sp-color-slider>`, or `<sp-color-wheel>`. It functions similarly to the handle on an `<sp-slider>`.
3+
The `<sp-color-handle>` is used to select a color on an `<sp-color-area>`, `<sp-color-slider>`, or `<sp-color-wheel>`. It provides a draggable control point for precise color selection within color components.
44

55
### Usage
66

77
[![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/color-handle?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/color-handle)
88
[![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/color-handle?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/color-handle)
99

10-
```
10+
**Note**: `<sp-color-handle>` is a primitive component designed to be used within other color selection components. It's not typically used directly in applications, but rather as part of higher-level color components like `<sp-color-area>`, `<sp-color-slider>`, or `<sp-color-wheel>`.
11+
12+
```bash
1113
yarn add @spectrum-web-components/color-handle
1214
```
1315

1416
Import the side effectful registration of `<sp-color-handle>` via:
1517

16-
```
18+
```javascript
1719
import '@spectrum-web-components/color-handle/sp-color-handle.js';
1820
```
1921

2022
When looking to leverage the `ColorHandle` base class as a type and/or for extension purposes, do so via:
2123

22-
```
24+
```javascript
2325
import { ColorHandle } from '@spectrum-web-components/color-handle';
2426
```
2527

26-
## Standard
28+
### Anatomy
29+
30+
The color handle consists of several key parts:
31+
32+
- A visual handle element that indicates the current position
33+
- Touch-responsive interaction areas
34+
- Color display showing the current selected color
35+
- Opacity checkerboard pattern for transparent colors
36+
- An optional `sp-color-loupe` that appears above the handle when the properties `open = true` and `disabled = false`
2737

2838
```html
2939
<sp-color-handle></sp-color-handle>
3040
```
3141

32-
## Disabled
42+
### Options
43+
44+
#### Color
45+
46+
The `color` property sets the visual color displayed within the handle. This accepts any valid CSS color format. The default color is `rgba(255, 0, 0, 0.5)` (semi-transparent red).
47+
48+
For a complete list of supported color formats, see the [ColorController documentation](/tools/color-controller#supported-color-formats).
49+
50+
**Transparency Support**: When using transparent colors, the handle displays an opacity checkerboard pattern background to clearly show the transparency level.
51+
52+
```html
53+
<div style="display: flex; gap: 16px; align-items: center; margin: 16px 0;">
54+
<!-- Hex color -->
55+
<div style="position: relative; height: 20px; margin: 20px;">
56+
<sp-color-handle color="#ff0000"></sp-color-handle>
57+
</div>
58+
59+
<!-- RGB format -->
60+
<div style="position: relative; height: 20px; margin: 20px;">
61+
<sp-color-handle color="rgb(255, 0, 0)"></sp-color-handle>
62+
</div>
63+
64+
<!-- RGBA format with transparency -->
65+
<div style="position: relative; height: 20px; margin: 20px;">
66+
<sp-color-handle color="rgba(255, 0, 0, 0.5)"></sp-color-handle>
67+
</div>
68+
69+
<!-- HSL format -->
70+
<div style="position: relative; height: 20px; margin: 20px;">
71+
<sp-color-handle color="hsl(0, 100%, 50%)"></sp-color-handle>
72+
</div>
73+
74+
<!-- Named colors -->
75+
<div style="position: relative; height: 20px; margin: 20px;">
76+
<sp-color-handle color="red"></sp-color-handle>
77+
</div>
78+
</div>
79+
```
80+
81+
### States
82+
83+
#### Standard
84+
85+
The default state of the color handle, ready for interaction:
86+
87+
```html
88+
<sp-color-handle></sp-color-handle>
89+
```
90+
91+
#### Disabled
92+
93+
A disabled color handle shows that the control exists but is not available for interaction. This maintains layout continuity and communicates that the handle may become available later:
3394

3495
```html
3596
<sp-color-handle disabled></sp-color-handle>
3697
```
3798

38-
## Open
99+
#### Open
39100

40-
When the `<sp-color-handle>` uses the `open` property, the `<sp-color-loupe>` component can be used above the handle to show the selected color that would otherwise be covered by a mouse, stylus, or finger on the down/touch state. This can be customized to appear only on finger-input, or always appear regardless of input type.
101+
When the `open` property is set, the `<sp-color-loupe>` component appears above the handle to show the selected color that would otherwise be covered by a mouse, stylus, or finger on the down/touch state. The loupe automatically appears for touch input (`pointerType === 'touch'`).
41102

42103
```html
43104
<div style="height: 72px"></div>
44105
<sp-color-handle open></sp-color-handle>
45106
```
107+
108+
**Automatic Behavior**: The loupe automatically opens when touched and closes when the touch interaction ends. For mouse and stylus input, the loupe remains hidden by default unless explicitly set to `open="true"`.
109+
110+
#### Focused
111+
112+
The color handle can receive keyboard focus when used within interactive color components. The focused state is managed automatically by the parent component and is indicated visually:
113+
114+
```html
115+
<sp-color-handle focused></sp-color-handle>
116+
```
117+
118+
### Behaviors
119+
120+
#### Pointer Interactions
121+
122+
The color handle automatically manages pointer events to provide the optimal user experience:
123+
124+
- **Touch Input**: When touched (`pointerType === 'touch'`), the color loupe automatically appears to prevent the finger from obscuring the selected color
125+
- **Mouse/Stylus Input**: The loupe remains hidden by default for precision pointing devices
126+
- **Pointer Capture**: The handle captures pointer events during interaction to ensure smooth dragging even when the pointer moves outside the handle area
127+
- **Event Handling**: The component listens for `pointerdown`, `pointerup`, and `pointercancel` events to manage the interaction lifecycle
128+
129+
#### Color Display
130+
131+
The handle displays the current color with proper support for transparency:
132+
133+
- Transparent colors are shown with an opacity checkerboard pattern background
134+
- The color updates in real-time as the user interacts with the parent color component
135+
- Supports all standard CSS color formats
136+
137+
For a complete list of supported color formats, see the [ColorController documentation](/tools/color-controller#supported-color-formats).
138+
139+
### Accessibility
140+
141+
The `<sp-color-handle>` is designed to work as part of accessible color selection components:
142+
143+
#### Keyboard Support
144+
145+
While the color handle itself is not directly keyboard accessible, it works in conjunction with its parent components ([`<sp-color-area>`](/components/color-area), [`<sp-color-slider>`](/components/color-slider), [`<sp-color-wheel>`](/components/color-wheel)) which provide comprehensive keyboard navigation.
146+
Example: Keyboard accessibility with `sp-color-area` as parent component
147+
148+
```html
149+
<sp-color-area></sp-color-area>
150+
```
151+
152+
#### Screen Reader Support
153+
154+
The color handle 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.
155+
156+
#### Touch Accessibility
157+
158+
- **Color Loupe**: Automatically appears for touch input to ensure the selected color remains visible
159+
- **Large Touch Target**: The handle provides an appropriately sized touch target for mobile interaction
160+
- **Pointer Capture**: Ensures reliable dragging behavior across different touch devices
161+
162+
#### Focus Management
163+
164+
Focus is managed by the parent color component, with the handle reflecting the focused state visually when its parent component has keyboard focus.

packages/color-wheel/src/ColorWheel.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,16 @@ export class ColorWheel extends Focusable {
8585
this.colorController.color = color;
8686
}
8787

88-
private get altered(): number {
89-
return this._altered;
90-
}
88+
private _baseStep: number = 1; // Preserves user's value
9189

9290
private set altered(altered: number) {
9391
this._altered = altered;
94-
this.step = Math.max(1, this.altered * 10);
92+
// Don't modify anything here!
93+
}
94+
95+
private get effectiveStep(): number {
96+
// Calculate on-the-fly without modifying stored values
97+
return this._altered > 0 ? this._baseStep * 10 : this._baseStep;
9598
}
9699

97100
private _altered = 0;
@@ -112,16 +115,16 @@ export class ColorWheel extends Focusable {
112115
let delta = 0;
113116
switch (key) {
114117
case 'ArrowUp':
115-
delta = this.step;
118+
delta = this.effectiveStep;
116119
break;
117120
case 'ArrowDown':
118-
delta = -this.step;
121+
delta = -this.effectiveStep;
119122
break;
120123
case 'ArrowLeft':
121-
delta = this.step * (this.isLTR ? -1 : 1);
124+
delta = this.effectiveStep * (this.isLTR ? -1 : 1);
122125
break;
123126
case 'ArrowRight':
124-
delta = this.step * (this.isLTR ? 1 : -1);
127+
delta = this.effectiveStep * (this.isLTR ? 1 : -1);
125128
break;
126129
default:
127130
return;
@@ -394,6 +397,12 @@ export class ColorWheel extends Focusable {
394397
this.addEventListener('blur', this.handleBlur);
395398
}
396399

400+
protected override willUpdate(changed: PropertyValues<this>): void {
401+
if (changed.has('step')) {
402+
this._baseStep = this.step;
403+
}
404+
}
405+
397406
private observer?: WithSWCResizeObserver['ResizeObserver'];
398407

399408
public override connectedCallback(): void {

0 commit comments

Comments
 (0)