Skip to content

Commit bdcb460

Browse files
authored
Astro v5 Fixes (playfulprogramming#1228)
One of the items seemingly not mentioned in the v5 migration guide is that `data-some-attr={false}` will now stringify `false` as `'false'` rather than remove it entirely. This caused a few bugs in our system that are now fixed
2 parents f3e9d29 + 950e2c3 commit bdcb460

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/views/blog-post/blog-post-layout/blog-post-layout.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
max-width: var(--max-width_xl);
88
margin: 0 auto;
99

10-
&:where(:not([data-hide-left-sidebar])) {
10+
&:where(:not([data-hide-left-sidebar="true"])) {
1111
@include from($tabletLarge) {
1212
grid-template-columns: 25% 1fr;
1313
}
1414
}
1515

1616
// in tablet view, when the sidebar is hidden, the "content" column needs to be centered
17-
&[data-hide-left-sidebar] {
17+
&[data-hide-left-sidebar="true"] {
1818
@include until($desktopSmall) {
1919
max-width: var(--max-width_m);
2020
}

src/views/blog-post/series/series-toc.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const showMoreText = translate(
101101
>
102102
const showMore = document.querySelector("#toggleAllButton");
103103
const showHideChapters = Array.from(
104-
document.querySelectorAll("[data-dont-show-initially]"),
104+
document.querySelectorAll("[data-dont-show-initially='true']"),
105105
);
106106

107107
let expanded = false;

src/views/blog-post/series/series-toc.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
padding: 0;
8989
}
9090

91-
.navigationItemOuter[data-dont-show-initially] {
91+
.navigationItemOuter[data-dont-show-initially="true"] {
9292
display: none;
9393
}
9494

@@ -134,7 +134,7 @@
134134
background: var(--series-nav_chapter-item_border_color_pressed);
135135
}
136136

137-
.navigationItem[data-is-active] {
137+
.navigationItem[data-is-active="true"] {
138138
color: var(--series-nav_chapter-item_title_color_selected);
139139
padding-left: calc(
140140
var(--series-nav_chapter-item_padding-horizontal) +
@@ -143,7 +143,7 @@
143143
);
144144
}
145145

146-
.navigationItem[data-is-active]::before {
146+
.navigationItem[data-is-active="true"]::before {
147147
content: " ";
148148
position: absolute;
149149
left: 0;
@@ -153,7 +153,7 @@
153153
background: var(--series-nav_chapter-item_border_color_selected);
154154
}
155155

156-
.navigationItem[data-is-active]::after {
156+
.navigationItem[data-is-active="true"]::after {
157157
content: " ";
158158
background-color: var(--series-nav_chapter-item_arrow_color);
159159
mask: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="Arrow"><path id="Vector 31" d="M5 8H15M15 8L11 4M15 8L11 12" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></g></svg>');

src/views/collections/framework-field-guide-fundamentals/components/collection-table-of-contents-fundamentals.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ const maxChapterToShow = 10;
5656
<script is:inline>
5757
let shown = false;
5858

59-
const lastChild = document.querySelector("[data-is-last-visible]");
59+
const lastChild = document.querySelector("[data-is-last-visible='true']");
6060

6161
function toggleChapterList() {
62-
const els = [...document.querySelectorAll("[data-should-hide]")];
62+
const els = [...document.querySelectorAll("[data-should-hide='true']")];
6363
if (!shown) {
6464
els.forEach((el) => (el.style.display = "block"));
6565
document.querySelector("#show-button").style.display = "none";
6666
document.querySelector("#hide-button").style.display = "inline-block";
67-
lastChild.removeAttribute("data-is-last-visible");
67+
lastChild.setAttribute("data-is-last-visible", "false");
6868
} else {
6969
els.forEach((el) => (el.style.display = "none"));
7070
document.querySelector("#hide-button").style.display = "none";
7171
document.querySelector("#show-button").style.display = "inline-block";
72-
lastChild.setAttribute("data-is-last-visible", "");
72+
lastChild.setAttribute("data-is-last-visible", "true");
7373
}
7474

7575
shown = !shown;

src/views/collections/framework-field-guide-fundamentals/components/collection-table-of-contents-fundamentals.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
position: relative;
5050
}
5151

52-
.postContainer:not([data-is-last-visible]):not(:last-child)::after {
52+
.postContainer:not([data-is-last-visible="true"]):not(:last-child)::after {
5353
position: absolute;
5454
content: " ";
5555
bottom: 0;
@@ -61,7 +61,7 @@
6161
background: var(--outline);
6262
}
6363

64-
.postContainer[data-should-hide] {
64+
.postContainer[data-should-hide="true"] {
6565
display: none;
6666
}
6767

src/views/person/person-page.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const postAuthors = new Map(
117117

118118
if (viewAllAchievementsButton) {
119119
const hiddenAchievements: HTMLElement[] = Array.from(
120-
document.querySelectorAll("[data-hide-initially]"),
120+
document.querySelectorAll("[data-hide-initially='true']"),
121121
);
122122

123123
let expanded = false;

0 commit comments

Comments
 (0)