Skip to content

Commit ca4397e

Browse files
committed
Fix duplicate element IDs
- This fixes clicking on the labels of switches other than the first one. Before, clicking on "Show difference" would always toggle the switch for the first test result, scrolling to the top of the page where the switch is. - This fixes the "More info" link always showing info for the first test result.
1 parent 8a762c3 commit ca4397e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

resources/snapshot_report_template.jinja2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
{% if diff.snapshot != "" %}
6565
<div class="form-check form-switch mt-1">
6666
<input class="form-check-input" type="checkbox" role="switch"
67-
id="flexSwitchCheckDefault" onchange="toggleOverlayCheckbox(this, {{ loop.index0 }})">
68-
<label class="form-check-label text-muted" for="flexSwitchCheckDefault">
67+
id="flexSwitchCheckDefault{{ loop.index0 }}" onchange="toggleOverlayCheckbox(this, {{ loop.index0 }})">
68+
<label class="form-check-label text-muted" for="flexSwitchCheckDefault{{ loop.index0 }}">
6969
Show difference
7070
</label>
7171
</div>
@@ -78,7 +78,7 @@
7878
<div class="w-100 d-flex justify-content-center mt-1">
7979
<span class="small">Output from test (<a href="#" class="link-primary mb-0"
8080
data-bs-toggle="modal"
81-
data-bs-target="#environmentModal">More info</a>)</span>
81+
data-bs-target="#environmentModal{{ loop.index0 }}">More info</a>)</span>
8282
</div>
8383
</div>
8484
<div class="col">
@@ -121,13 +121,13 @@
121121
</div>
122122

123123
{# Modal with debug info: #}
124-
<div class="modal modal-lg fade" id="environmentModal" tabindex="-1"
125-
aria-labelledby="environmentModalLabel"
124+
<div class="modal modal-lg fade" id="environmentModal{{ loop.index0 }}" tabindex="-1"
125+
aria-labelledby="environmentModalLabel{{ loop.index0 }}"
126126
aria-hidden="true">
127127
<div class="modal-dialog">
128128
<div class="modal-content">
129129
<div class="modal-header">
130-
<h5 class="modal-title" id="environmentModalLabel">More info for <span
130+
<h5 class="modal-title" id="environmentModalLabel{{ loop.index0 }}">More info for <span
131131
class="font-monospace">{{ diff.test_name }}</span></h5>
132132
<button type="button" class="btn-close" data-bs-dismiss="modal"
133133
aria-label="Close"></button>

0 commit comments

Comments
 (0)