Skip to content

Conversation

@nikkimk
Copy link
Contributor

@nikkimk nikkimk commented Oct 16, 2025

Description

Motivation and context

Related issue(s)

  • fixes [Issue Number]

Screenshots (if appropriate)


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Descriptive Test Statement

    1. Go here
    2. Do this action
    3. Expect this result
  • Descriptive Test Statement

    1. Go here
    2. Do this action
    3. Expect this result

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

nikkimk and others added 30 commits October 7, 2025 11:18
feat(label): init field label mixin
…5732)

* fix(menu): added check to find focused element within root context

* fix(menu): added story

* fix(menu): added test

* chore(menu): added changeset

* fix(menu): added global const for component input pattern

* fix(menu): remove delimiter from the regexp constructor

* chore: skipped prod and vrt tests on the new story

* chore: fix tests helpers

* fix: check for cross root boundary

* fix: code comments

---------

Co-authored-by: Rajdeep Chandra <[email protected]>
Co-authored-by: Rajdeep Chandra <[email protected]>
Co-authored-by: Rajdeep Chandra <[email protected]>
@nikkimk nikkimk self-assigned this Oct 16, 2025
@changeset-bot
Copy link

changeset-bot bot commented Oct 16, 2025

🦋 Changeset detected

Latest commit: 287fe7b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 84 packages
Name Type
@spectrum-web-components/menu Minor
@spectrum-web-components/breadcrumbs Minor
@spectrum-web-components/combobox Minor
@spectrum-web-components/picker Minor
@spectrum-web-components/custom-vars-viewer Minor
example-project-rollup Patch
example-project-webpack Patch
@spectrum-web-components/story-decorator Minor
@spectrum-web-components/bundle Minor
@spectrum-web-components/action-menu Minor
documentation Patch
@spectrum-web-components/eslint-plugin Minor
@spectrum-web-components/accordion Minor
@spectrum-web-components/action-bar Minor
@spectrum-web-components/action-button Minor
@spectrum-web-components/action-group Minor
@spectrum-web-components/alert-banner Minor
@spectrum-web-components/alert-dialog Minor
@spectrum-web-components/asset Minor
@spectrum-web-components/avatar Minor
@spectrum-web-components/badge Minor
@spectrum-web-components/button-group Minor
@spectrum-web-components/button Minor
@spectrum-web-components/card Minor
@spectrum-web-components/checkbox Minor
@spectrum-web-components/clear-button Minor
@spectrum-web-components/close-button Minor
@spectrum-web-components/coachmark Minor
@spectrum-web-components/color-area Minor
@spectrum-web-components/color-field Minor
@spectrum-web-components/color-handle Minor
@spectrum-web-components/color-loupe Minor
@spectrum-web-components/color-slider Minor
@spectrum-web-components/color-wheel Minor
@spectrum-web-components/contextual-help Minor
@spectrum-web-components/dialog Minor
@spectrum-web-components/divider Minor
@spectrum-web-components/dropzone Minor
@spectrum-web-components/field-group Minor
@spectrum-web-components/field-label Minor
@spectrum-web-components/help-text Minor
@spectrum-web-components/icon Minor
@spectrum-web-components/icons-ui Minor
@spectrum-web-components/icons-workflow Minor
@spectrum-web-components/icons Minor
@spectrum-web-components/iconset Minor
@spectrum-web-components/illustrated-message Minor
@spectrum-web-components/infield-button Minor
@spectrum-web-components/link Minor
@spectrum-web-components/meter Minor
@spectrum-web-components/modal Minor
@spectrum-web-components/number-field Minor
@spectrum-web-components/overlay Minor
@spectrum-web-components/picker-button Minor
@spectrum-web-components/popover Minor
@spectrum-web-components/progress-bar Minor
@spectrum-web-components/progress-circle Minor
@spectrum-web-components/radio Minor
@spectrum-web-components/search Minor
@spectrum-web-components/sidenav Minor
@spectrum-web-components/slider Minor
@spectrum-web-components/split-view Minor
@spectrum-web-components/status-light Minor
@spectrum-web-components/swatch Minor
@spectrum-web-components/switch Minor
@spectrum-web-components/table Minor
@spectrum-web-components/tabs Minor
@spectrum-web-components/tags Minor
@spectrum-web-components/textfield Minor
@spectrum-web-components/thumbnail Minor
@spectrum-web-components/toast Minor
@spectrum-web-components/tooltip Minor
@spectrum-web-components/top-nav Minor
@spectrum-web-components/tray Minor
@spectrum-web-components/underlay Minor
@spectrum-web-components/vrt-compare Minor
@spectrum-web-components/base Minor
@spectrum-web-components/grid Minor
@spectrum-web-components/opacity-checkerboard Minor
@spectrum-web-components/reactive-controllers Minor
@spectrum-web-components/shared Minor
@spectrum-web-components/styles Minor
@spectrum-web-components/theme Minor
@spectrum-web-components/truncated Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5809

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

"component",
"css"
],
"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/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

"development": "./src/index.dev.js",
"default": "./src/index.js"
},
"./sp-field-label-mixin.js": {
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 ascending order. './sp-field-label-mixin.js' should be before './src/index.js'.

reviewdog suggestion errorGitHub comment range and suggestion line range must be same. L42-L42 v.s. L27-L44

superClass: T,
slotName?: string,
excludedSelectors: string[] = []
) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] <@typescript-eslint/explicit-function-return-type> reported by reviewdog 🐶
Missing return type on function.

"component",
"css"
],
"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-L74

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

Tachometer results

Chrome

menu permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 522 kB 164.82ms - 166.98ms - faster ✔
3% - 5%
5.76ms - 9.19ms
branch 510 kB 172.04ms - 174.70ms slower ❌
3% - 6%
5.76ms - 9.19ms
-
Firefox

menu permalink

test-basic

Version Bytes Avg Time vs remote vs branch
npm latest 522 kB 335.97ms - 344.95ms - faster ✔
3% - 7%
9.19ms - 24.73ms
branch 510 kB 351.09ms - 363.75ms slower ❌
3% - 7%
9.19ms - 24.73ms
-


```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.


```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.

* @slot tooltip - Tooltip to to be applied to the the Picker Button
*/
export class Combobox extends Textfield {
export class Combobox extends FieldLabelMixin(Textfield, 'field-label') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since combobox uses the default slot for menuitems, we needed a field-label slot for the visual label

`;
}

protected override get _ariaLabel(): string | undefined {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to override textfieldBase's logic to include the labelling that exists in combobox

id="combobox-disabled-items"
style="min-width: 80px;--spectrum-textfield-m-min-width:0; width:160px;"
>
<span slot="field-label">Some fruits are disabled (light DOM)</span>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the label slot

@property({ type: String, reflect: true, attribute: 'side-aligned' })
public sideAligned?: 'start' | 'end';

public renderFieldLabel(fieldId?: string): TemplateResult {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

renders the label in the shadowDOM of the element

} = {}): TemplateResult => {
return html`
<sp-field-label for="name" size=${ifDefined(size)}>
<sp-number-field size=${ifDefined(size)} value="100">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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


```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

`;
}

protected renderPlaceholderContent(): TemplateResult {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I separated this into its own function so it would be easier to override the render for a Picker.

`;
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed this to make it easier to override for picker without completely overriding the render. In future we should reconsider whether we should have a PickerBase that can be used for menus have different roles and labelling expectations than a picker which is semantically a select-only combobox.

@coveralls
Copy link
Collaborator

coveralls commented Oct 16, 2025

Pull Request Test Coverage Report for Build 18572166522

Details

  • 348 of 396 (87.88%) changed or added relevant lines in 4 files are covered.
  • 45 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.2%) to 97.719%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/textfield/src/Textfield.ts 48 51 94.12%
packages/combobox/src/Combobox.ts 55 62 88.71%
packages/picker/src/Picker.ts 153 191 80.1%
Files with Coverage Reduction New Missed Lines %
packages/combobox/src/Combobox.ts 10 96.1%
packages/picker/src/Picker.ts 35 91.34%
Totals Coverage Status
Change from base Build 18535024849: -0.2%
Covered Lines: 34417
Relevant Lines: 35041

💛 - Coveralls

@caseyisonit caseyisonit added the Status: WIP PR is a work in progress or draft label Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: WIP PR is a work in progress or draft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants