Skip to content
Draft
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
12f2fc9
feat(label): init field label mixin
nikkimk Sep 24, 2025
b6ea53b
feat(textfield): updated textfiled docs to use label mixin
nikkimk Sep 24, 2025
6117e6b
feat(field-label): added mixin to package exports
nikkimk Sep 25, 2025
d5448f1
feat(field-label): added optional slot name for rendering label slot
nikkimk Sep 25, 2025
cf1c9d7
docs(textfield): implemented label mixin in stories
nikkimk Sep 25, 2025
743d553
test(textfield): added test for slotted label
nikkimk Sep 25, 2025
c386f09
feat(textfield): added default slot observer for label changes
nikkimk Sep 29, 2025
e812721
test(textfield): added tests for slotted label
nikkimk Sep 29, 2025
5be1715
docs(number-field): updated number field docs based on text field lab…
nikkimk Sep 29, 2025
56954ed
docs(number-field): updated stories with slotted label
nikkimk Sep 29, 2025
b5bdd62
docs(color-field): updated docs with slotted label
nikkimk Sep 29, 2025
d6dde5b
feat(field-label): updated interface to include optional slot name fo…
nikkimk Sep 29, 2025
e0e85c5
feat(combobox): added label slot to combobox
nikkimk Sep 29, 2025
3c226f8
docs(combobox): added slotted label to docs
nikkimk Sep 29, 2025
183218c
test(combobox): updates tests with slotted label
nikkimk Sep 29, 2025
c408b4e
fix(combobox): fixed combobox field id for label
nikkimk Sep 29, 2025
84c67c3
feat(field-label): added label slot change handler to mixin
nikkimk Oct 7, 2025
8822ec1
feat(combobox): added slot change handlers
nikkimk Oct 7, 2025
4868c82
feat(field-label): hide field label if not used
nikkimk Oct 7, 2025
9cdc838
feat(textfield): use field label mixin to observe slot
nikkimk Oct 7, 2025
d36080d
feat(combobox): use field label mixin to observe slot
nikkimk Oct 7, 2025
c304d57
feat(combobox): added placeholder
nikkimk Oct 9, 2025
da60cf4
fix(textfield): fixed issue with detecting slot content
nikkimk Oct 9, 2025
c40127f
fix(field-label): fixed issue with slot content detection in text field
nikkimk Oct 9, 2025
9717285
test(textfield): removed unneccessary id attribute
nikkimk Oct 9, 2025
0ffa462
fix(fieldl-label): fixed mixin to allow slot naming
nikkimk Oct 10, 2025
4ac3c92
feat(combobox): updated combobox, stories and tests for field label m…
nikkimk Oct 10, 2025
dd22117
fix(field-label): corrected linting issues
nikkimk Oct 10, 2025
4263db4
fix(menu): MenuItem focus stealing from input elements on mouseover (…
Rajdeepc Oct 10, 2025
58fab11
fix(field-label): made field id optional for picker
nikkimk Oct 10, 2025
6a22c11
fix(field-label): made field id optional for picker
nikkimk Oct 10, 2025
93289a4
feat(picker): added field label mixin to pciker and picker stories
nikkimk Oct 10, 2025
f0b3a39
fix(textfiled): fixed element name in warning
nikkimk Oct 15, 2025
462f5bb
fix(combobox): fixed element name in warning
nikkimk Oct 15, 2025
8d7b1ad
docs(picker): updated stories
nikkimk Oct 16, 2025
3934124
feat(picker): added field label mizin to picker without affecting pic…
nikkimk Oct 16, 2025
56e2e38
docs(textfield): documented default label slot
nikkimk Oct 16, 2025
c124b0c
Merge branch 'main' into nikkimk/1044-migrate-picker
nikkimk Oct 16, 2025
c7561a8
fix(picker): added field label styles
nikkimk Oct 16, 2025
287fe7b
fix(picker): fixes test errors
nikkimk Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cruel-eels-open.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spectrum-web-components/menu': minor
---

**Fixed** MenuItem focus stealing from input elements on mouseover by enhanceing MenuItem's `handleMouseover` method to detect when an input element currently has focus and prevent stealing focus in those cases.
64 changes: 48 additions & 16 deletions packages/color-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The color field consists of several key parts:
- **Size variations**: Different size options to match your design requirements

```html
<sp-color-field value="#ffff00"></sp-color-field>
<sp-color-field value="#ffff00">Background color</sp-color-field>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color field uses TextfieldBase which now includes the mixin for a slotted label

```

### Options
Expand All @@ -45,15 +45,23 @@ The color field consists of several key parts:
<sp-tab-panel value="s">

```html
<sp-color-field size="s" value="#ffff00"></sp-color-field>
<sp-color-field
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Label can be an attribute.

size="s"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
<sp-tab value="m">Medium</sp-tab>
<sp-tab-panel value="m">

```html
<sp-color-field size="m" value="#ffff00"></sp-color-field>
<sp-color-field
size="m"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -62,7 +70,11 @@ The color field consists of several key parts:
<sp-tab-panel value="l">

```html
<sp-color-field size="l" value="#ffff00"></sp-color-field>
<sp-color-field
size="l"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -71,7 +83,11 @@ The color field consists of several key parts:
<sp-tab-panel value="xl">

```html
<sp-color-field size="xl" value="#ffff00"></sp-color-field>
<sp-color-field
size="xl"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -82,15 +98,15 @@ The color field consists of several key parts:
When `view-color` is true, the color handle will be rendered. This is useful for development and debugging purposes.

```html
<sp-color-field view-color value="#f00"></sp-color-field>
<sp-color-field view-color value="#f00">Icon color</sp-color-field>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or label can be slotted.

```

#### Quiet

A quiet color field provides a more subtle appearance:

```html
<sp-color-field quiet value="#e6e600"></sp-color-field>
<sp-color-field quiet value="#e6e600">Icon color</sp-color-field>
```

### States
Expand All @@ -100,23 +116,23 @@ A quiet color field provides a more subtle appearance:
The default state of the color field, ready for user input:

```html
<sp-color-field value="#ffff00"></sp-color-field>
<sp-color-field value="#ffff00">Icon color</sp-color-field>
```

#### Read Only

A readonly color field that displays the color value but prevents user modification:

```html
<sp-color-field readonly value="#ffff00"></sp-color-field>
<sp-color-field readonly value="#ffff00">Icon color</sp-color-field>
```

#### Invalid Input

If the input value is not a valid color, `<sp-color-field>` will not accept it and may show validation feedback:

```html
<sp-color-field value="not a color"></sp-color-field>
<sp-color-field value="not a color">Icon color</sp-color-field>
```

### Behaviors
Expand All @@ -134,7 +150,7 @@ For a complete list of supported color formats, see the [ColorController documen
A hexadecimal color is specified with: `#RRGGBB`. `RR` (red), `GG` (green) and `BB` (blue) are hexadecimal integers between `00` and `FF` specifying the intensity of the color.

```html
<sp-color-field view-color value="#ff0000"></sp-color-field>
<sp-color-field view-color value="#ff0000" label="Text color"></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -144,7 +160,7 @@ A hexadecimal color is specified with: `#RRGGBB`. `RR` (red), `GG` (green) and `
Shorthand hexadecimal color values are also supported. `#RGB` is a shorthand for `#RRGGBB`. In the shorthand form, `R` (red), `G` (green), and `B` (blue) are hexadecimal characters between `0` and `F`. Each character is repeated to create the full 6-digit color code. For example, `#123` would expand to `#112233`.

```html
<sp-color-field view-color value="#f00"></sp-color-field>
<sp-color-field view-color value="#f00" label="Text color"></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -154,7 +170,11 @@ Shorthand hexadecimal color values are also supported. `#RGB` is a shorthand for
An RGB color value is specified with: rgb(red, green, blue). Each parameter defines the intensity of the color with a value between 0 and 255.

```html
<sp-color-field view-color value="rgb(255,0,0)"></sp-color-field>
<sp-color-field
view-color
value="rgb(255,0,0)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -164,7 +184,11 @@ An RGB color value is specified with: rgb(red, green, blue). Each parameter defi
An RGBA color value is specified with: `rgba(red, green, blue, alpha)`. The `alpha` parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque).

```html
<sp-color-field view-color value="rgba(0,255,0,0.3)"></sp-color-field>
<sp-color-field
view-color
value="rgba(0,255,0,0.3)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -174,7 +198,11 @@ An RGBA color value is specified with: `rgba(red, green, blue, alpha)`. The `alp
An HSL color value is specified with: hsl(hue, saturation, lightness). Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is blue. Saturation and lightness are percentages.

```html
<sp-color-field view-color value="hsl(234, 70%, 50%)"></sp-color-field>
<sp-color-field
view-color
value="hsl(234, 70%, 50%)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -184,7 +212,11 @@ An HSL color value is specified with: hsl(hue, saturation, lightness). Hue is a
An HSV color value is specified with: hsv(hue, saturation, value). Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is blue. Saturation and value are percentages.

```html
<sp-color-field view-color value="hsv(0, 70%, 50%)"></sp-color-field>
<sp-color-field
view-color
value="hsv(0, 70%, 50%)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand Down
2 changes: 0 additions & 2 deletions packages/color-field/stories/color-field-sizes.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* governing permissions and limitations under the License.
*/
import { TemplateResult } from '@spectrum-web-components/base';

import '@spectrum-web-components/field-label/sp-field-label.js';
import '@spectrum-web-components/help-text/sp-help-text.js';
import { ColorFieldMarkup } from './template.js';

Expand Down
46 changes: 23 additions & 23 deletions packages/combobox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ mutate() {
### Quiet

```html
<sp-field-label for="color">Color</sp-field-label>
<sp-combobox id="color" quiet>
<sp-combobox quiet>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -140,8 +140,8 @@ The suggested popup menu items will remain the same regardless of the currently-
Whenever the currently-typed input exactly matches the `value` of a popup menu item, that item is automatically selected.

```html
<sp-field-label for="color-none" autocomplete="none">Color</sp-field-label>
<sp-combobox id="color-none">
<sp-combobox>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -155,8 +155,8 @@ Whenever the currently-typed input exactly matches the `value` of a popup menu i
The popup menu items are filtered to only those completing the currently-input value.

```html
<sp-field-label for="color-list" autocomplete="list">Color</sp-field-label>
<sp-combobox id="color-list">
<sp-combobox>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -170,15 +170,15 @@ The popup menu items are filtered to only those completing the currently-input v
<sp-tab-panel value="disabled">

```html
<sp-field-label for="color-disabled">Color</sp-field-label>
<sp-combobox id="color-disabled" disabled>
<sp-combobox disabled>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
</sp-combobox>
<br />
<sp-field-label for="color-disabled-item">Color</sp-field-label>
<sp-combobox id="color">
<sp-combobox>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue" disabled>Blue</sp-menu-item>
Expand All @@ -190,8 +190,8 @@ The popup menu items are filtered to only those completing the currently-input v
<sp-tab-panel value="invalid">

```html
<sp-field-label for="color-invalid">Color</sp-field-label>
<sp-combobox id="color-invalid" invalid>
<sp-combobox invalid>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -206,8 +206,8 @@ The popup menu items are filtered to only those completing the currently-input v
<sp-tab-panel value="pending">

```html
<sp-field-label for="color">Color</sp-field-label>
<sp-combobox id="color" pending>
<sp-combobox pending>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -222,12 +222,12 @@ The popup menu items are filtered to only those completing the currently-input v
#### Provide a label

A combobox must be labeled.
Typically, you should render a visible label via `<sp-field-label>`.
Typically, you should render a visible label via the `label` slot.
For exceptional cases, provide an accessible label via the `label` attribute.

```html
<sp-field-label for="color">Color</sp-field-label>
<sp-combobox id="color">
<sp-combobox>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -245,8 +245,8 @@ See [help text](../help-text) and [tooltip](../tooltip) for more information.
<sp-tab-panel value="help-text">

```html
<sp-field-label for="color1">Color</sp-field-label>
<sp-combobox id="color1">
<sp-combobox>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -259,8 +259,8 @@ See [help text](../help-text) and [tooltip](../tooltip) for more information.
<sp-tab-panel value="negative-help-text">

```html
<sp-field-label for="color2">Color</sp-field-label>
<sp-combobox id="color2" required>
<sp-combobox required>
<span slot="field-label">Color</span>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
Expand All @@ -274,8 +274,8 @@ See [help text](../help-text) and [tooltip](../tooltip) for more information.
<sp-tab-panel value="tooltip">

```html
<sp-field-label for="color3">Color</sp-field-label>
<sp-combobox id="color3">
<sp-combobox>
<span slot="field-label">Color</span>
<sp-tooltip slot="tooltip">
Color options, such as red, green, or blue.
</sp-tooltip>
Expand Down
2 changes: 2 additions & 0 deletions packages/combobox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"dependencies": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jsonc/sort-keys> reported by reviewdog 🐶
Expected object keys to be in specified order. 'dependencies' should be before 'keywords'.

reviewdog suggestion errorGitHub comment range and suggestion line range must be same. L66-L66 v.s. L53-L80

"@spectrum-web-components/action-button": "1.9.0",
"@spectrum-web-components/base": "1.9.0",
"@spectrum-web-components/field-label": "1.9.0",
"@spectrum-web-components/icon": "1.9.0",
"@spectrum-web-components/icons-ui": "1.9.0",
"@spectrum-web-components/menu": "1.9.0",
Expand All @@ -74,6 +75,7 @@
"@spectrum-web-components/popover": "1.9.0",
"@spectrum-web-components/progress-circle": "1.9.0",
"@spectrum-web-components/reactive-controllers": "1.9.0",
"@spectrum-web-components/shared": "1.9.0",
"@spectrum-web-components/textfield": "1.9.0"
},
"types": "./src/index.d.ts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jsonc/sort-keys> reported by reviewdog 🐶
Expected object keys to be in specified order. 'types' should be before 'dependencies'.

reviewdog suggestion errorGitHub comment range and suggestion line range must be same. L81-L81 v.s. L53-L81

Expand Down
Loading
Loading