From 26764cc31c1dca9cddc93b9ed1290c820b74d1e3 Mon Sep 17 00:00:00 2001 From: Erallie <31375589+Erallie@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:48:04 -0700 Subject: [PATCH] Added aria label with raw text --- main.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.ts b/main.ts index 771cad4..e38af7a 100644 --- a/main.ts +++ b/main.ts @@ -429,15 +429,15 @@ class TimestampModal extends Modal { while (child) { const nextChild = child.nextSibling; child.addClass('timestamp-buttons'); + let timestampStr: string; + if (child.id == "unix") + timestampStr = date.utc().format('X'); + else + timestampStr = ``; + child.ariaLabel = timestampStr; child.onClickEvent((ev) => { - let insertedText: string; - let button = ev.currentTarget as HTMLButtonElement; - if (button.id == "unix")// - insertedText = date.utc().format('X'); - else - insertedText = ``; - editor.replaceSelection(insertedText); - editor.setCursor(cursor.line, cursor.ch + insertedText.length); + editor.replaceSelection(timestampStr); + editor.setCursor(cursor.line, cursor.ch + timestampStr.length); let historyList = plugin.settings.history; let newTimestamp = `${input.value} ${timezone.value}`