@abreen/tada 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/globals.ts +1 -1
- package/package.json +6 -2
- package/src/timezone/index.ts +13 -3
- package/src/timezone/style.scss +6 -0
package/build/globals.ts
CHANGED
|
@@ -43,7 +43,7 @@ export default function createGlobals(
|
|
|
43
43
|
})
|
|
44
44
|
.join('');
|
|
45
45
|
const renderTimeZoneChooser = () =>
|
|
46
|
-
`<span class="time-zone-label" hidden>Times shown in </span><select class="time-zone" hidden disabled>${options}</select><noscript>Times shown in ${defaultTz.abbreviation}.</noscript>`;
|
|
46
|
+
`<span class="time-zone-label" hidden>Times shown in </span><select class="time-zone" hidden disabled aria-label="Time zone">${options}</select><noscript>Times shown in ${defaultTz.abbreviation}.</noscript>`;
|
|
47
47
|
|
|
48
48
|
return {
|
|
49
49
|
isHomePage: subPath === 'index',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abreen/tada",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A static site generator",
|
|
6
6
|
"license": "MIT",
|
|
@@ -84,7 +84,11 @@
|
|
|
84
84
|
},
|
|
85
85
|
"lint-staged": {
|
|
86
86
|
"*.{ts,js}": "prettier --write",
|
|
87
|
-
"
|
|
87
|
+
"src/**/*.scss": [
|
|
88
|
+
"stylelint --fix --config stylelint.config.mjs",
|
|
89
|
+
"prettier --write"
|
|
90
|
+
],
|
|
91
|
+
"templates/**/*.scss": "prettier --write",
|
|
88
92
|
"*.json": "prettier --write",
|
|
89
93
|
"functional_tests/**/*.py": [
|
|
90
94
|
"bun run scripts/python-module.ts ruff check --fix",
|
package/src/timezone/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const STORAGE_KEY = 'timezoneSelection';
|
|
2
|
+
const TIMEZONE_SELECT_LABEL = 'Time zone';
|
|
2
3
|
|
|
3
4
|
type PeriodStyle = [am: string, pm: string];
|
|
4
5
|
|
|
@@ -112,6 +113,13 @@ function init(element: HTMLSelectElement, selectedTz: string) {
|
|
|
112
113
|
element.value = selectedTz;
|
|
113
114
|
element.hidden = false;
|
|
114
115
|
element.disabled = false;
|
|
116
|
+
if (
|
|
117
|
+
!element.hasAttribute('aria-label') &&
|
|
118
|
+
!element.hasAttribute('aria-labelledby') &&
|
|
119
|
+
(element.labels?.length ?? 0) === 0
|
|
120
|
+
) {
|
|
121
|
+
element.setAttribute('aria-label', TIMEZONE_SELECT_LABEL);
|
|
122
|
+
}
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
function dominantPeriodStyle(
|
|
@@ -236,7 +244,7 @@ export default (window: Window) => {
|
|
|
236
244
|
const resetBtn = window.document.createElement('button');
|
|
237
245
|
resetBtn.type = 'button';
|
|
238
246
|
resetBtn.innerHTML =
|
|
239
|
-
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">' +
|
|
247
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" focusable="false">' +
|
|
240
248
|
'<line x1="18" y1="6" x2="6" y2="18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>' +
|
|
241
249
|
'<line x1="6" y1="6" x2="18" y2="18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>' +
|
|
242
250
|
'</svg>';
|
|
@@ -254,8 +262,10 @@ export default (window: Window) => {
|
|
|
254
262
|
const sync = (val: string) => {
|
|
255
263
|
selectEl.value = val;
|
|
256
264
|
const isDefault = val === defaultTz.value;
|
|
257
|
-
resetBtn.
|
|
258
|
-
resetBtn.
|
|
265
|
+
resetBtn.classList.toggle('is-hidden', isDefault);
|
|
266
|
+
resetBtn.disabled = isDefault;
|
|
267
|
+
resetBtn.tabIndex = isDefault ? -1 : 0;
|
|
268
|
+
resetBtn.setAttribute('aria-hidden', String(isDefault));
|
|
259
269
|
};
|
|
260
270
|
|
|
261
271
|
choosers.push({ sync });
|