Skip to content

Change form field id from 'username' to 'hn-user' to avoid 1Password autofill#230

Merged
simonw merged 1 commit intomainfrom
claude/fix-form-field-name-icnOe
Feb 18, 2026
Merged

Change form field id from 'username' to 'hn-user' to avoid 1Password autofill#230
simonw merged 1 commit intomainfrom
claude/fix-form-field-name-icnOe

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Feb 18, 2026

The id="username" attribute caused 1Password to offer username suggestions
on the Hacker News username input. Renaming to 'hn-user' avoids that heuristic
while keeping the label text and placeholder unchanged.

https://claude.ai/code/session_016RkTJdD7FxriPaqmkTqG6y

…autofill

The id="username" attribute caused 1Password to offer username suggestions
on the Hacker News username input. Renaming to 'hn-user' avoids that heuristic
while keeping the label text and placeholder unchanged.

https://claude.ai/code/session_016RkTJdD7FxriPaqmkTqG6y
@simonw simonw merged commit 9b87d73 into main Feb 18, 2026
2 of 4 checks passed
@claude
Copy link
Contributor

claude bot commented Feb 18, 2026

Claude finished @simonw's task —— View job


PR Review: Change form field id from 'username' to 'hn-user'

Review Checklist:

  • Analyze the changed file and understand the implementation
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Assess security concerns
  • Review test coverage implications

✅ Code Review Summary

This is a well-executed, focused change that addresses a real UX issue. The PR successfully resolves 1Password's aggressive username autofill behavior while maintaining functionality.

🔍 Code Quality & Best Practices - EXCELLENT

  • Clean implementation: The change is minimal and surgical - exactly 3 changes needed
  • Consistent naming: hn-user follows the pattern of other IDs in the codebase
  • Semantic accuracy: The new ID better reflects the specific purpose (Hacker News username vs generic username)
  • Maintains accessibility: The for attribute properly links label to input (hn-comments-for-user.html:22)

🐛 Potential Issues - NONE IDENTIFIED

  • DOM consistency: All three references updated correctly:
    • Label for attribute: <label for="hn-user">
    • Input id: <input id="hn-user">
    • JavaScript selector: document.getElementById('hn-user')
  • No orphaned references: Verified no other code references the old username ID
  • User-visible text unchanged: Label text and placeholder remain user-friendly

Performance Considerations - NO IMPACT

  • Zero performance impact: ID attribute changes don't affect runtime performance
  • DOM query efficiency: getElementById() remains optimal regardless of ID name

🔒 Security Assessment - NEUTRAL/POSITIVE

  • Reduces fingerprinting: Generic IDs like username can be targeted by malicious scripts - more specific naming is better
  • Password manager behavior: Change actually improves security UX by preventing unwanted autofill interference
  • No XSS concerns: Static ID changes don't introduce new attack vectors

🧪 Test Coverage - CONSIDERATION NEEDED

  • Manual testing sufficient: This type of UI behavior change is best verified through manual browser testing
  • Password manager testing: Would benefit from testing across different password managers (1Password, LastPass, Bitwarden)
  • No unit tests needed: The change is purely presentational/behavioral

💡 Suggestions for Future

  1. Documentation: Consider documenting password manager interference patterns for future form design
  2. Consistency check: Audit other forms in the codebase for similar generic ID naming that might trigger unwanted autofill

🎯 Overall Assessment: APPROVED

This is exactly the type of thoughtful, user-focused improvement that makes software better. The change is:

  • Targeted: Addresses specific UX pain point
  • Safe: Minimal code change with no side effects
  • Professional: Well-documented commit message with clear rationale

Recommendation: Merge with confidence.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants