Test the QR dialog id fix from #1688 - #1694
Merged
Merged
Conversation
Referral controls can render in several tabs, and a dialog trigger resolves its target with `getElementById`. #1688 made the ids unique but left the two-tab case uncovered. * Guard `controls_id` on `is defined` rather than truthiness, so a switch to `loop.index0` cannot put tab 0 back on the fallback id. * Drop the duplicated prefix from the dialog id suffix. * Extract `_referral_controls_stream` in the tests.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a regression test to ensure each tab’s referral-controls QR dialog has a unique DOM id (preventing getElementById from binding all triggers to the first dialog), and updates the templates to generate safer, shorter dialog ids and more robust per-tab namespacing.
Review performed following the repository’s custom Copilot instructions (including AGENTS.md and the referenced platform code-review checklists).
Changes:
- Add a
TabsBlock-level test that verifies each tab’s QR trigger targets the dialog within its own panel (catching duplicate ids). - Shorten the QR dialog id suffix in the referral-controls component to reduce redundancy while preserving uniqueness via the parent
id. - Make the referral-controls block’s
controls_idconditional robust to a futuretab_index=0scenario by checkingis definedinstead of truthiness.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| springfield/cms/tests/test_blocks.py | Adds a TabsBlock regression test for per-tab QR dialog id uniqueness; refactors test stream construction via _referral_controls_stream. |
| springfield/cms/templates/components/referral-controls.html | Shortens the internal QR dialog id suffix to -qr-dialog while keeping trigger/dialog wiring consistent. |
| springfield/cms/templates/cms/blocks/referral-controls.html | Updates controls_id generation to avoid collapsing ids if tab_index ever becomes 0 (e.g., with loop.index0). |
Comment on lines
+13
to
+18
| {# | ||
| The id namespaces this instance's dialog, so it has to differ per tab. It tests | ||
| `is defined` rather than truthiness so that switching `tabs.html` to | ||
| `loop.index0` cannot silently drop the first tab onto the fallback id. | ||
| #} | ||
| {% set controls_id = ('fl-referral-controls-' ~ section_id ~ '-' ~ tab_index) if section_id is defined and tab_index is defined else 'fl-referral-controls' %} |
wen-2018
approved these changes
Aug 7, 2026
bluewave41
pushed a commit
that referenced
this pull request
Sep 22, 2026
Referral controls can render in several tabs, and a dialog trigger resolves its target with `getElementById`. #1688 made the ids unique but left the two-tab case uncovered. * Guard `controls_id` on `is defined` rather than truthiness, so a switch to `loop.index0` cannot put tab 0 back on the fallback id. * Drop the duplicated prefix from the dialog id suffix. * Extract `_referral_controls_stream` in the tests.
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.
Summary
Test the duplicate QR dialog id fix from #1688.
Significant changes and points to review
The test: Renders
TabsBlockwith referral controls in two tabs, the case WT-1476 Ff referral hug page styling #1688 fixed. It pairs each trigger with the dialog in its own panel, because comparing two document-order lists passes even when the ids are duplicated. Mutation-tested against a staticcontrols_idand against a cross-wireddata-target-id.is definedguard: The riskiest part to review, and the only change no test covers.tabs.htmlnumbers tabs withloop.index, so the old truthiness check worked only because that index is 1-based.loop.index0would have collapsed tab 0 of every tabs section onto one shared id.Shorter dialog id: Now
fl-referral-controls-hub-1-qr-dialog. Referenced nowhere outside the template, not in CSS, JS, or tests._referral_controls_stream: Replaces five copies of the StreamBlock wire format in the tests. Mechanical.Context