diff options
author | metamuffin <metamuffin@disroot.org> | 2024-05-11 20:51:10 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-05-11 20:51:10 +0200 |
commit | 41f05c2839eb71eff646b0345984b5da1afcc456 (patch) | |
tree | 3185aea6c460164c1ad067683a3dd60d67930c5f /src/element.ts | |
parent | 17fbd41f033ca7aa11f91785904220ed509de1f3 (diff) | |
download | jshelper-41f05c2839eb71eff646b0345984b5da1afcc456.tar jshelper-41f05c2839eb71eff646b0345984b5da1afcc456.tar.bz2 jshelper-41f05c2839eb71eff646b0345984b5da1afcc456.tar.zst |
add aria label
Diffstat (limited to 'src/element.ts')
-rw-r--r-- | src/element.ts | 2 |
1 files changed, 2 insertions, 0 deletions
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<E> { onmouseenter?: (e: E) => void, onmouseleave?: (e: E) => void, onchange?: (e: E) => void, + aria_label?: string, } function apply_opts<E extends HTMLElement>(e: E, o: Opts<E>): (() => void) | void { @@ -37,6 +38,7 @@ function apply_opts<E extends HTMLElement>(e: E, o: Opts<E>): (() => 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<K extends keyof HTMLElementTagNameMap> = string |