Skip to content

Commit 21bd711

Browse files
authored
Use click handlers instead of inserting anchor tags in .table-seamless-links (#2117)
This way we don't need to think about the DOM elements being moved around and we can stop click events in nested elements.
1 parent 2b9f506 commit 21bd711

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

evap/evaluation/templates/base.html

+3-6
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,9 @@
179179

180180
// activate clickable hover tables
181181
document.querySelectorAll(".table-seamless-links [data-url]").forEach(row => {
182-
for(const table_data of row.children) {
183-
const wrapping_anchor = document.createElement("a");
184-
wrapping_anchor.href = row.dataset["url"];
185-
wrapping_anchor.append(...table_data.childNodes);
186-
table_data.replaceChildren(wrapping_anchor);
187-
}
182+
row.addEventListener("click", () => {
183+
window.location.assign(row.dataset.url);
184+
});
188185
});
189186

190187
document.querySelectorAll(".hover-row").forEach(row => {

evap/static/scss/components/_tables.scss

-11
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,8 @@ $table-colors: (
3535
padding-bottom: 0.4rem;
3636
}
3737

38-
// Seamless links in tables
39-
//
40-
// -1- Expand links to fill the cell
4138
.table-seamless-links td {
4239
overflow: hidden;
43-
44-
a:not(.btn) {
45-
color: $black;
46-
text-decoration: none;
47-
display: block; // -1-
48-
margin: -10em; // -1-
49-
padding: 10em; // -1-
50-
}
5140
}
5241

5342
// Hoverable rows

0 commit comments

Comments
 (0)