Add Angular Input Group Sample Demonstrating Correct id and for Attributes for Accessibility
#3755
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a new Input Group sample (
input-group-sample-7) that demonstrates the correct use ofidandforattributes for proper label-input association, addressing a critical accessibility gap in the existing samples.Problem
Current Input Group samples use
<label for="...">but the corresponding<input>elements only have anameattribute without a matchingid. This breaks screen reader behavior and accessibility:Current Pattern (Broken):
The
forattribute points to "fullName" but there is no element withid="fullName", onlyname="fullName". This causes:Solution
The new sample demonstrates the correct pattern with proper
idandforpairing:Correct Pattern:
What's Included
Sample Features
idattribute matching the label'sforattributeEducational Content
The sample includes an accessibility information section that explains:
idandforpairing is essential for screen readersidandnameattributesTesting
idandforpairing for all inputsChanges Made
src/app/data-entries/input-group/input-group-sample-7/input-group-sample-7.component.ts- Component implementationinput-group-sample-7.component.html- Template with correct examplesinput-group-sample-7.component.scss- Styling for accessibility info sectioninput-group-sample-7.component.spec.ts- Unit testssrc/app/data-entries/data-entries.routes.ts- Added route configurationsrc/app/data-entries/data-entries-routes-data.ts- Added sample metadataImpact
This sample provides developers with a clear reference for implementing accessible forms with Ignite UI Angular, helping prevent accessibility issues in production applications.
Closes #[issue-number]
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.comng build --configuration production (my-app)(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #3692
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.