Skip to content

ZCU-PUB/Duplicate id in html#1239

Merged
milanmajchrak merged 1 commit intocustomer/zcu-pubfrom
zcu-pub/duplicate-id-search-navbar-container
Mar 10, 2026
Merged

ZCU-PUB/Duplicate id in html#1239
milanmajchrak merged 1 commit intocustomer/zcu-pubfrom
zcu-pub/duplicate-id-search-navbar-container

Conversation

@Kasinhou
Copy link

@Kasinhou Kasinhou commented Mar 10, 2026

Problem description

Found duplicate id search-navbar-container

Error: Found duplicate IDs on http://dev-5.pc:84/home:
    search-navbar-container (2x)

    expect(received).toHaveLength(expected)

    Expected length: 0
    Received length: 1
    Received array:  ["search-navbar-container (2x)"]

Sync verification

If en.json5 or cs.json5 translation files were updated:

  • Run yarn run sync-i18n -t src/assets/i18n/cs.json5 -i to synchronize messages, and changes are included in this PR.

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

Copy link

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

Resolves an accessibility/test failure caused by duplicate id="search-navbar-container" elements on pages where the search navbar is rendered more than once (e.g., via theming).

Changes:

  • Replaced the duplicated id attribute with a search-navbar-container CSS class in both the base and custom theme templates.
  • Updated Angular unit tests to query the container by class instead of id.
  • Removed the (now unnecessary) Cypress a11y exclusion comment referencing the duplicate id.

Reviewed changes

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

File Description
src/themes/custom/app/search-navbar/search-navbar.component.html Removes duplicated id to prevent invalid HTML and duplicate-ID detection failures.
src/app/search-navbar/search-navbar.component.html Same fix in the base template to keep behavior consistent across theme/non-theme rendering.
src/app/search-navbar/search-navbar.component.spec.ts Updates selectors to match the new class-based container.
cypress/e2e/header.cy.ts Cleans up obsolete comment about excluding the duplicate id from a11y checks.

@Kasinhou Kasinhou requested a review from milanmajchrak March 10, 2026 10:26
@milanmajchrak
Copy link
Collaborator

milanmajchrak commented Mar 10, 2026

@Kasinhou When you changed search-navbar-container to class - shouldn't you update it also in the .scss? Won't be styles broken now?

@Kasinhou
Copy link
Author

@Kasinhou When you changed search-navbar-container to class - shouldn't you update it also in the .scss? Won't be styles broken now?

no .scss references to search-navbar-container

@milanmajchrak milanmajchrak merged commit 7825421 into customer/zcu-pub Mar 10, 2026
9 checks passed
@Kasinhou Kasinhou self-assigned this Mar 10, 2026
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.

3 participants