Skip to content

Commit 76a5f21

Browse files
committed
add for attribute to labels
1 parent b22b234 commit 76a5f21

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

index.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
</button>
125125
<div class="collapsible-content list">
126126
<div class="simple-widget">
127-
<label>Archive compression level</label>
127+
<label for="setting-archive-compression-level">Archive compression level</label>
128128
<input
129129
type="range"
130130
id="setting-archive-compression-level"
@@ -134,11 +134,13 @@
134134
value="6" />
135135
</div>
136136
<div class="simple-widget">
137-
<label>Export modified files only (developer)</label>
137+
<label for="setting-export-modified-only"
138+
>Export modified files only (developer)</label
139+
>
138140
<input type="checkbox" id="setting-export-modified-only" class="switch" />
139141
</div>
140142
<div class="simple-widget">
141-
<label>Combine packs (experimental!)</label>
143+
<label for="setting-combine-packs">Combine packs (experimental!)</label>
142144
<input type="checkbox" id="setting-combine-packs" class="switch" />
143145
</div>
144146
</div>
@@ -155,7 +157,7 @@
155157

156158
<template id="datapack-template">
157159
<div class="datapack">
158-
<img />
160+
<img alt="" />
159161
<div class="name-and-description">
160162
<h3 class="name"></h3>
161163
<p class="description"></p>
@@ -185,7 +187,7 @@ <h3 class="widget-text">A heading widget...</h3>
185187

186188
<template id="image-widget-template">
187189
<div class="widget image-widget">
188-
<img src="" class="widget-image" />
190+
<img src="" class="widget-image" alt="" />
189191
</div>
190192
</template>
191193

@@ -239,6 +241,11 @@ <h3 class="widget-text">A heading widget...</h3>
239241
<a href="https://github.com/autumn-mck/dptoolkit-web/issues">Report issues</a> &nbsp;∗&nbsp;
240242
<a href="https://everloste.github.io/discord">Discord server</a>
241243
&nbsp;∗&nbsp;
244+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
245+
<path fill="#169B62" d="M4 5C1.791 5 0 6.791 0 9v18c0 2.209 1.791 4 4 4h8V5H4z" />
246+
<path fill="#EEE" d="M12 5h12v26H12z" />
247+
<path fill="#FF883E" d="M32 5h-8v26h8c2.209 0 4-1.791 4-4V9c0-2.209-1.791-4-4-4z" />
248+
</svg>
242249
<svg viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">
243250
<path
244251
fill="#5BCEFA"

src/config.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class ConfigClass {
5151

5252
const widgetText = clone.querySelector(".widget-text") as HTMLElement | null;
5353
const inputElement = clone.querySelector(".widget-input") as HTMLInputElement | null;
54-
54+
5555
if ("text" in element && widgetText) {
5656
const sanitized_html = DOMPurify.sanitize(element.text);
5757
widgetText.innerHTML = sanitized_html;
@@ -61,7 +61,6 @@ export class ConfigClass {
6161
(clone.querySelector(".widget-switch-input") as HTMLInputElement).checked = !(
6262
element.value.default == 0
6363
);
64-
6564
} else if (type === "slider" || type === "number") {
6665
const widgetValue = clone.querySelector(".widget-value-text") as HTMLElement | null;
6766
if (element.value.default !== undefined) {
@@ -82,7 +81,6 @@ export class ConfigClass {
8281
}
8382

8483
inputElement!.addEventListener("input", updateDisplayedValue);
85-
8684
} else if (type === "image") {
8785
const imageFile = await zip.file(element.file)?.async("blob");
8886
if (imageFile) {
@@ -92,7 +90,13 @@ export class ConfigClass {
9290
}
9391

9492
// Set input ID
95-
if (inputElement) inputElement.id = "widget-input-" + this.datapack_id.toString() + index.toString();
93+
if (inputElement) {
94+
const id = "widget-input-" + this.datapack_id.toString() + index.toString();
95+
const label = clone.querySelector("label") as HTMLLabelElement;
96+
97+
inputElement.id = id;
98+
label.setAttribute("for", id);
99+
}
96100

97101
return clone;
98102
})
@@ -261,7 +265,7 @@ function accessorIsValid(accessor: object) {
261265
function processTransformer(method_input: number | boolean | undefined, slot_values: {[key: string]: any}, transformer: Transformer): DatapackChangeValue {
262266

263267
if (typeof transformer === "number") {
264-
return transformer as number;
268+
return transformer;
265269
}
266270

267271
else if (typeof transformer === "string") {

style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ a:link {
4646
color: var(--accent-color);
4747
}
4848
a:visited {
49-
color: #dec7fa;
49+
color: var(--accent-color);
5050
}
5151

5252
button,

0 commit comments

Comments
 (0)