From 41f05c2839eb71eff646b0345984b5da1afcc456 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 11 May 2024 20:51:10 +0200 Subject: add aria label --- src/element.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/element.ts') diff --git a/src/element.ts b/src/element.ts index 6f2a28d..7a492b3 100644 --- a/src/element.ts +++ b/src/element.ts @@ -20,6 +20,7 @@ interface Opts { onmouseenter?: (e: E) => void, onmouseleave?: (e: E) => void, onchange?: (e: E) => void, + aria_label?: string, } function apply_opts(e: E, o: Opts): (() => void) | void { @@ -37,6 +38,7 @@ function apply_opts(e: E, o: Opts): (() => void) | voi if (typeof o?.class == "string") e.classList.add(o.class) if (typeof o?.class == "object") e.classList.add(...o.class) if (o.style) for (const k in o.style) { const v = o.style[k]; if (v !== undefined) e.style[k] = v } + if (o.aria_label) e.ariaLabel = o.aria_label } type EEl = string -- cgit v1.2.3-70-g09d2