Skip to content

Add id attr to flag components#173

Merged
Flo0807 merged 1 commit intomainfrom
add-random-ids
Oct 3, 2025
Merged

Add id attr to flag components#173
Flo0807 merged 1 commit intomainfrom
add-random-ids

Conversation

@Flo0807
Copy link
Owner

@Flo0807 Flo0807 commented Oct 3, 2025

closes #172

@Flo0807 Flo0807 self-assigned this Oct 3, 2025
@Flo0807 Flo0807 added the enhancement New feature or request label Oct 3, 2025
@Flo0807 Flo0807 changed the title Add unique id to flags to prevent duplicated ids Add id attr to flag component Oct 3, 2025
@Flo0807 Flo0807 requested a review from Copilot October 3, 2025 18:05
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

This PR adds an id attribute to flag components to address SVG ID conflicts when multiple flags are rendered on the same page. The implementation automatically suffixes internal SVG IDs with the provided ID or a generated unique ID to ensure uniqueness.

  • Adds a templatize_ids/1 function to dynamically modify SVG IDs and their references
  • Updates the component template to accept an optional id attribute with automatic unique ID generation
  • Updates tests and documentation to reflect the new ID functionality

Reviewed Changes

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

Show a summary per file
File Description
test/helpers_test.exs Comprehensive test coverage for the new templatize_ids/1 function
test/flagpack_test.exs Updated existing tests to include ID attributes in component assertions
lib/mix/tasks/build.ex Modified build task to process SVG files with ID templatization
lib/helpers.ex Added templatize_ids/1 function to handle SVG ID conflicts
assets/flagpack.eex Updated component template to support ID attribute with auto-generation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Flo0807 Flo0807 changed the title Add id attr to flag component Add id attr to flag components Oct 3, 2025
@Flo0807 Flo0807 merged commit aa485a2 into main Oct 3, 2025
1 check passed
@Flo0807 Flo0807 deleted the add-random-ids branch October 3, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate IDs when using the same flag multiple times

2 participants