UFAL/Resolve duplicate html IDs in submission form#1234
Open
UFAL/Resolve duplicate html IDs in submission form#1234
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to eliminate duplicate HTML id attributes in the submission form, primarily by introducing a shared unique-id mechanism for dynamic form controls and adjusting template bindings to use property binding instead of string interpolation.
Changes:
- Added a static
UniqueIdRegistryto generate de-duplicated element IDs for repeated dynamic form models. - Updated dynamic form container + scrollable dropdown to use the registry-backed
idgetter and to release IDs on destroy. - Updated the Clarin license selector option
idbinding to use Angular property binding ([id]) instead of interpolation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/app/submission/sections/clarin-license-resource/section-license.component.html |
Uses [id] binding for license option items to avoid duplicate/static IDs and template interpolation. |
src/app/shared/form/builder/ds-dynamic-form-ui/unique-id-registry.ts |
Introduces a static registry to allocate/release unique HTML IDs across dynamic form instances. |
src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts |
Adds registry-backed id and releases it in ngOnDestroy. |
src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts |
Adds registry-backed id getter and releases it in ngOnDestroy. |
src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html |
Switches label id from model.id to the (now unique) id. |
...ilder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts
Show resolved
Hide resolved
src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem description
Duplicate ids in html across multiple pages in customer instances.
Issue: https://github.com/dataquest-dev/dspace-customers/issues/398
previous PR (did not solve the duplicates): #1221
Sync verification
If en.json5 or cs.json5 translation files were updated:
yarn run sync-i18n -t src/assets/i18n/cs.json5 -ito synchronize messages, and changes are included in this PR.Manual Testing (if applicable)
Copilot review