Skip to content

[no ci] feat(1958): add template to sd-input without label but still accessible#2964

Draft
clemens-vi wants to merge 3 commits into
feat/issue-workflow-mcpfrom
feat/ui-1958-add-template-to-sd-input-without-label-but-still-accessible
Draft

[no ci] feat(1958): add template to sd-input without label but still accessible#2964
clemens-vi wants to merge 3 commits into
feat/issue-workflow-mcpfrom
feat/ui-1958-add-template-to-sd-input-without-label-but-still-accessible

Conversation

@clemens-vi

Copy link
Copy Markdown

NOTE: implemented by agent "Github Issue implementer"

Description:

This pull request adds new accessibility-focused examples and corresponding automated tests for visually hidden labels in both combobox and search input components. These changes demonstrate how to implement visually hidden labels that remain accessible to screen readers, following WCAG guidelines.

Accessibility examples:

  • Added a new story, ComboboxWithVisuallyHiddenLabel, in combobox.stories.ts to showcase a search combobox with a visually hidden label, including styling and usage notes compliant with WCAG.
  • Added a new story, InputWithVisuallyHiddenLabel, in input.stories.ts to demonstrate a search input with a visually hidden label, complete with appropriate styling and accessibility warnings.

Automated accessibility tests:

  • Introduced a Playwright test, Combobox With Visually Hidden Label, in combobox.a11y.ts to verify the accessibility tree for the new combobox example.
  • Added a Playwright test, Input With Visually Hidden Label, in input.a11y.ts to check the accessibility tree for the new input example.

Definition of Reviewable:

  • E2E tests (features, a11y, bug fixes) are created/updated
  • Stories (features, a11y) are created/updated

@changeset-bot

changeset-bot Bot commented Apr 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8b7a869

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Storybook has been deployed for branch feat_ui-1958-add-template-to-sd-input-without-label-but-still-accessible

@mariohamann mariohamann marked this pull request as draft April 29, 2026 10:15
…at/ui-1958-add-template-to-sd-input-without-label-but-still-accessible

# Conflicts:
#	packages/docs/src/stories/templates/combobox.a11y.ts
#	packages/docs/src/stories/templates/input.a11y.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds accessibility-focused template examples for search input and combobox variants that keep labels available to assistive technology while visually hiding them, plus Playwright ARIA snapshot coverage.

Changes:

  • Adds visually hidden label examples for sd-input and sd-combobox.
  • Adds new template accessibility test files for input and combobox stories.
  • Extends coverage to existing input/combobox template stories in those files.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
packages/docs/src/stories/templates/input.stories.ts Adds the visually hidden search input label template.
packages/docs/src/stories/templates/input.a11y.ts Adds ARIA snapshot tests for input templates.
packages/docs/src/stories/templates/combobox.stories.ts Adds the visually hidden search combobox label template.
packages/docs/src/stories/templates/combobox.a11y.ts Adds ARIA snapshot tests for combobox templates.

Comment on lines +11 to +13
- img "Open":
- img
- button "Open"
await expect(page.locator('body')).toMatchAriaSnapshot(`
- region "Top right notifications"
- region "Bottom center notifications"
- searchbox "Search"
* Use this pattern when a search input should not show a visible label but still needs to be accessible to screen readers.
* The label is visually hidden via `::part(form-control-label)` while remaining available in the accessibility tree.
*
* __Warning:__ Visually hidden labels are only permitted for search inputs (WCAG Success Criterion 1.3.1). Do not use this pattern for other input types.
* Use this pattern when a search combobox should not show a visible label but still needs to be accessible to screen readers.
* The label is visually hidden via `::part(form-control-label)` while remaining available in the accessibility tree.
*
* __Warning:__ Visually hidden labels are only permitted for search inputs (WCAG Success Criterion 1.3.1). Do not use this pattern for other input types.
Comment on lines +48 to +58
.input-visually-hidden-label::part(form-control-label) {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
Comment on lines +140 to +150
.combobox-visually-hidden-label::part(form-control-label) {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
@clemens-vi

clemens-vi commented May 18, 2026

Copy link
Copy Markdown
Author

@copilot: use the write-template-stories skill to review the new template stories in this PR.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

await expect(page.locator('body')).toMatchAriaSnapshot(`
- region "Top right notifications"
- region "Bottom center notifications"
- searchbox "Search"
Comment on lines +11 to +13
- img "Open":
- img
- button "Open"
* Use this pattern when a search input should not show a visible label but still needs to be accessible to screen readers.
* The label is visually hidden via `::part(form-control-label)` while remaining available in the accessibility tree.
*
* __Warning:__ Visually hidden labels are only permitted for search inputs (WCAG Success Criterion 1.3.1). Do not use this pattern for other input types.
* Use this pattern when a search combobox should not show a visible label but still needs to be accessible to screen readers.
* The label is visually hidden via `::part(form-control-label)` while remaining available in the accessibility tree.
*
* __Warning:__ Visually hidden labels are only permitted for search inputs (WCAG Success Criterion 1.3.1). Do not use this pattern for other input types.
Comment on lines +38 to +61
* ### Search Input with Visually Hidden Label
*
* Use this pattern when a search input should not show a visible label but still needs to be accessible to screen readers.
* The label is visually hidden via `::part(form-control-label)` while remaining available in the accessibility tree.
*
* __Warning:__ Visually hidden labels are only permitted for search inputs (WCAG Success Criterion 1.3.1). Do not use this pattern for other input types.
*/
export const InputWithVisuallyHiddenLabel = {
render: () => html`
<style>
.input-visually-hidden-label::part(form-control-label) {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
</style>
<div class="w-[250px]">
<sd-input class="input-visually-hidden-label" type="search" label="Search" placeholder="Search..."></sd-input>
Comment on lines +140 to +150
.combobox-visually-hidden-label::part(form-control-label) {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋 Backlog

Development

Successfully merging this pull request may close these issues.

2 participants