Skip to content

Checkbox IDs should be namespaced to avoid DOM conflicts #56

@codeuxius

Description

@codeuxius

Describe the issue

The cookie category checkboxes use generic IDs like id="analytics", id="marketing", etc. Since DOM IDs must be unique, this can conflict with other elements on the page that may already use these common IDs.

Expected behavior

Checkbox IDs should be namespaced to avoid conflicts, e.g. analytics-consent-category or lcg-analytics instead of just analytics.

Additional context

The issue is that id="${category}" is used directly. A simple fix would be to prefix or suffix the IDs:

// Instead of:
id="${category}"

// Use something like:
id="${category}-consent-category"
// or
id="lcg-${category}"

The corresponding label[for] attributes would need updating to match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions