-
Notifications
You must be signed in to change notification settings - Fork 130
Fix label for
attribute when not scoped to model
#3696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: b6b4909 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this 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 fixes the label for
attribute assignment when the scope_id_false: false
option is used. The fix ensures that the label's for
attribute is properly set to match the input's ID after the ID has been finalized during initialization.
Key changes:
- Moved label
for
attribute assignment to later in the initialization process - Added test coverage for the fixed behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
app/lib/primer/forms/dsl/input.rb | Moves the @label_arguments[:for] = id assignment from early initialization to after ID processing is complete |
test/lib/primer/forms/input_test.rb | Adds test assertions to verify label for attributes are correctly set in existing test cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Defers assigning label `for` value to later in `initialize` method, ensuring the `scope_id_false: false` option is respected. Closes primer#3695
9130190
to
7b26e33
Compare
This requires an upstream fix. However, given the potential to cause accessibility problems and broken UX (e.g. focus), we should track the current and desired/fixed behavior downstream. See primer/view_components#3696 See primer/view_components#3695
There was a problem hiding this comment.
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 3 out of 3 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Passing over to @jonrohan who would know more about this than me |
Just a quick note: I've kept this PR narrow in scope (forgive the pun) and tried to solve this in the "least invasive" way possible. However, there are other issues (such as namespacing - see #3698) for which I'm trying to find a more robust solution. |
This requires an upstream fix. However, given the potential to cause accessibility problems and broken UX (e.g. focus), we should track the current and desired/fixed behavior downstream. See primer/view_components#3696 See primer/view_components#3695
What are you trying to accomplish?
Defers assigning label
for
value to later ininitialize
method, ensuring thescope_id_false: false
option is respected.Integration
It may require updating calling code that relies on the incorrect behavior.
List the issues that this change affects.
Closes #3695
Risk Assessment
Merge checklist