Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

  • Understand the HTML 4.01 vs HTML5 ID attribute rules
  • Update FieldIdGenerator.cs to support HTML5 (remove first-character-must-be-letter rule)
  • Update comments and documentation to reflect HTML5
  • Remove "Arrange Act Assert" comments from unit tests
  • Update unit tests to reflect HTML5 behavior
  • Build and test the changes
  • Optimize fast-path check with IndexOfAny
  • Add comprehensive whitespace test
  • Address code review feedback - simplify tests
  • Move whitespace test to Theory InlineData
  • Use SearchValues with complete Unicode whitespace blacklist for correctness
  • Fix consistency between fast and slow path validation

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 14, 2026 14:52
- Remove HTML 4.01 first-character-must-be-letter rule
- Simplify to only replace whitespace and periods with underscores
- Update documentation to reference HTML5 instead of HTML 4.01
- Remove redundant SearchValues and helper methods
- Update tests to reflect HTML5 behavior (no prepending 'z', brackets allowed)
- Remove "Arrange Act Assert" comments from all unit tests

Co-authored-by: ilonatommy <[email protected]>
- Use IndexOfAny for more efficient fast-path check
- Add test for various whitespace characters (tab, newline, carriage return)

Co-authored-by: ilonatommy <[email protected]>
Copilot AI changed the title [WIP] Update FieldIdGenerator to support HTML5 Update FieldIdGenerator to support HTML5 instead of HTML 4.01 Jan 14, 2026
Copilot AI requested a review from ilonatommy January 14, 2026 14:57
- Combine whitespace tests into one
- Remove redundant Fact tests (already covered by Theory test)
- Remove duplicate InlineData entries

Co-authored-by: ilonatommy <[email protected]>
- Convert standalone Fact test to InlineData in Theory test
- Further streamlines test structure

Co-authored-by: ilonatommy <[email protected]>
@ilonatommy ilonatommy marked this pull request as ready for review January 14, 2026 16:36
@ilonatommy ilonatommy requested a review from a team as a code owner January 14, 2026 16:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates FieldIdGenerator to support HTML5 ID attribute rules instead of HTML 4.01, simplifying the validation logic and reducing code complexity.

Changes:

  • Removed HTML 4.01 restrictions (first character must be a letter) to allow any non-whitespace characters
  • Simplified character validation to only replace whitespace and periods with underscores
  • Consolidated test cases into a single Theory test method with InlineData attributes

Reviewed changes

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

File Description
src/Components/Web/src/Forms/FieldIdGenerator.cs Updated to HTML5 rules: removed first-character validation, simplified character replacement logic, removed SearchValues dependency
src/Components/Web/test/Forms/FieldIdGeneratorTest.cs Consolidated tests into single Theory method, removed AAA comments, updated test cases to reflect HTML5 behavior

@ilonatommy ilonatommy added the area-blazor Includes: Blazor, Razor Components label Jan 14, 2026
@ilonatommy ilonatommy enabled auto-merge (squash) January 15, 2026 07:12
- Add SearchValues with all Unicode whitespace characters and period
- Ensures fast path catches all whitespace cases consistently
- Add test for non-breaking space (U+00A0)

Co-authored-by: ilonatommy <[email protected]>
auto-merge was automatically disabled January 15, 2026 09:25

Head branch was pushed to by a user without write access

- Use InvalidIdChars.Contains() in slow path for consistency
- Ensures both paths validate the same set of characters

Co-authored-by: ilonatommy <[email protected]>
@ilonatommy ilonatommy merged commit d0b197e into main Jan 20, 2026
25 checks passed
@ilonatommy ilonatommy deleted the copilot/update-fieldidgenerator-for-html5 branch January 20, 2026 14:16
@dotnet-policy-service dotnet-policy-service bot added this to the 11.0-preview1 milestone Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants