diff options
author | metamuffin <metamuffin@disroot.org> | 2023-09-29 19:31:42 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-09-29 19:31:42 +0200 |
commit | fec2a11612646e48b886211429583ba4029c634a (patch) | |
tree | 10190803732e64fb87ede531970f5eb194f88eec /client-web/source/helper.ts | |
parent | 3bf58dc257d64e4048185b2fa3a525d65a0475b1 (diff) | |
download | keks-meet-fec2a11612646e48b886211429583ba4029c634a.tar keks-meet-fec2a11612646e48b886211429583ba4029c634a.tar.bz2 keks-meet-fec2a11612646e48b886211429583ba4029c634a.tar.zst |
give icons empty alt to make it clear they are not important
Diffstat (limited to 'client-web/source/helper.ts')
-rw-r--r-- | client-web/source/helper.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/client-web/source/helper.ts b/client-web/source/helper.ts index ba4dd0c..51036a1 100644 --- a/client-web/source/helper.ts +++ b/client-web/source/helper.ts @@ -14,6 +14,7 @@ interface Opts<E> { for?: string, type?: string, href?: string, + alt?: string, onclick?: (e: E) => void, onchange?: (e: E) => void, role?: "dialog" @@ -32,6 +33,7 @@ function apply_opts<E extends HTMLElement>(el: E, o: Opts<E>) { if (o.for) (el as unknown as HTMLLabelElement).htmlFor = o.for if (o.type && el instanceof HTMLInputElement) el.type = o.type if (o.href && el instanceof HTMLAnchorElement) el.href = o.href; + if (o.alt !== undefined && el instanceof HTMLImageElement) el.alt = o.alt; if (typeof o?.class == "string") el.classList.add(o.class) if (typeof o?.class == "object") el.classList.add(...o.class) if (o.aria_modal) el.ariaModal = "true" @@ -41,7 +43,7 @@ function apply_opts<E extends HTMLElement>(el: E, o: Opts<E>) { if (o.src && el instanceof HTMLImageElement) el.src = o.src; if (o.hidden) el.hidden = o.hidden; if (o.icon) { - el.prepend(e("img", { src: `/assets/icons/${o.icon}.svg`, class: "icon" })) + el.prepend(e("img", { src: `/assets/icons/${o.icon}.svg`, alt: "", class: "icon" })) } } |