From 633af67516ab9a4b94cfd739b4024cc9c8e82ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:09:44 +0200 Subject: Fix spelling of aria-labelledby. --- static/components/tab-group-element.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'static/components') diff --git a/static/components/tab-group-element.ts b/static/components/tab-group-element.ts index 8a65964d..1c58b0fb 100644 --- a/static/components/tab-group-element.ts +++ b/static/components/tab-group-element.ts @@ -113,7 +113,7 @@ class TabGroupElement extends ComponentVEvent { role: 'tabpanel', tabindex: 0, hidden: 'hidden', - 'aria-labeledby': label_id, + 'aria-labelledby': label_id, }) tabContainer.replaceChildren(child); @@ -129,7 +129,7 @@ class TabGroupElement extends ComponentVEvent { } removeTab(tab: HTMLElement) { - let id = tab.getAttribute('aria-labeledby')! + let id = tab.getAttribute('aria-labelledby')! let label = document.getElementById(id) if (label) { if (label.ariaSelected === 'true') { -- cgit v1.2.3 From 1e17bfa0cc08674c7f2a668481f10458d9fbfaaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:10:06 +0200 Subject: Change element types for tabs. --- static/components/tab-group-element.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'static/components') diff --git a/static/components/tab-group-element.ts b/static/components/tab-group-element.ts index 1c58b0fb..0da11a56 100644 --- a/static/components/tab-group-element.ts +++ b/static/components/tab-group-element.ts @@ -29,7 +29,7 @@ class TabGroupElement extends ComponentVEvent { constructor(uid?: string) { super(uid); - this.menu = makeElement('menu', {}, { + this.menu = makeElement('div', {}, { role: 'tablist', 'aria-label': 'Simple Tabs', }) @@ -105,10 +105,10 @@ class TabGroupElement extends ComponentVEvent { title: title, 'aria-selected': false, 'aria-controls': tab_id, - ... extra_attributes, + ...extra_attributes, }) - let tabContainer = makeElement('article', {}, { + let tabContainer = makeElement('div', {}, { id: tab_id, role: 'tabpanel', tabindex: 0, -- cgit v1.2.3 From fffdada0b38d8339f48f92be03d34247107d3662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:10:22 +0200 Subject: Change boolean attribute value to itself. --- static/components/tab-group-element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'static/components') diff --git a/static/components/tab-group-element.ts b/static/components/tab-group-element.ts index 0da11a56..5cfeab2d 100644 --- a/static/components/tab-group-element.ts +++ b/static/components/tab-group-element.ts @@ -156,7 +156,7 @@ class TabGroupElement extends ComponentVEvent { /* hide all tab panels */ for (let tabcontent of this.querySelectorAll('[role="tabpanel"]')) { - tabcontent.setAttribute('hidden', 'true'); + tabcontent.setAttribute('hidden', 'hidden'); } /* unselect all (selected) tab handles */ for (let item of this.querySelectorAll('[aria-selected="true"]')) { -- cgit v1.2.3 From bbecd2476ebddb2731065aad2f3895c5074c9ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:11:08 +0200 Subject: Stop using with-label. --- static/components/vevent-edit.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'static/components') diff --git a/static/components/vevent-edit.ts b/static/components/vevent-edit.ts index ee368296..bf72678c 100644 --- a/static/components/vevent-edit.ts +++ b/static/components/vevent-edit.ts @@ -7,7 +7,7 @@ import { DateTimeInput } from './date-time-input' import { vcal_objects } from '../globals' import { VEvent, RecurrenceRule } from '../vevent' import { create_event } from '../server_connect' -import { to_boolean } from '../lib' +import { to_boolean, gensym } from '../lib' /* Edit form for a given VEvent. Used as the edit tab of popups. @@ -24,6 +24,14 @@ class ComponentEdit extends ComponentVEvent { let frag = this.template.content.cloneNode(true) as DocumentFragment let body = frag.firstElementChild! this.replaceChildren(body); + + for (let el of this.querySelectorAll('[data-label]')) { + let label = document.createElement('label'); + let id = el.id || gensym('input'); + el.id = id; + label.htmlFor = id; + label.textContent = (el as HTMLElement).dataset.label!; + } } connectedCallback() { -- cgit v1.2.3 From 15bba899c326a30d21fd7d1bdbaec4afe44e47f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:25:56 +0200 Subject: Replace some .tagName with instanceof. --- static/components/tab-group-element.ts | 2 +- static/components/vevent.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'static/components') diff --git a/static/components/tab-group-element.ts b/static/components/tab-group-element.ts index 5cfeab2d..e90997e9 100644 --- a/static/components/tab-group-element.ts +++ b/static/components/tab-group-element.ts @@ -174,7 +174,7 @@ class TabGroupElement extends ComponentVEvent { /* returns our rrule tab if we have one */ has_rrule_tab(): Element | false { for (let child of this.children) { - if ((child.firstChild! as HTMLElement).tagName.toLowerCase() === 'vevent-edit-rrule') { + if (child.firstChild! instanceof EditRRule) { return child; } } diff --git a/static/components/vevent.ts b/static/components/vevent.ts index 2193eabc..5852a2ff 100644 --- a/static/components/vevent.ts +++ b/static/components/vevent.ts @@ -19,7 +19,6 @@ abstract class ComponentVEvent extends HTMLElement { let real_uid; - // console.log(this.tagName); if (uid) { // console.log('Got UID directly'); real_uid = uid; -- cgit v1.2.3