-
Notifications
You must be signed in to change notification settings - Fork 81
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
fix: enable using custom id for form-item label #3701
Conversation
Kudos, SonarCloud Quality Gate passed!
|
this.__labelId = this.__labelNode.id; | ||
} else { | ||
// The new label node doesn't have an id yet. Generate a unique one. | ||
const uniqueId = (FormItem._uniqueLabelId = 1 + FormItem._uniqueLabelId || 0); |
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.
Could we generate a unique id only once in the constructor?
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.
I did consider it but maybe it's cleaner to identify individual <label>
instances with separate IDs? Sharing the same ID would require us to remove the id from a <label>
element when removed/replaced with a new label, and a custom ID would need to be an exception since it should not be removed.
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.
Ah, right, this is reasonable. 👍
This ticket/PR has been released with Vaadin 23.1.0.alpha3 and is also targeting the upcoming stable 23.1.0 version. |
Fixes #3682