From 249c5b8d12ab93a348da54bca398973604fafaea Mon Sep 17 00:00:00 2001 From: abaevbog Date: Fri, 7 Jun 2024 04:25:37 -0500 Subject: [PATCH] vpat 49: refactor note format preference section (#4027) "Note format" section in "Export" tab is technically a table and is announced as such by screen readers, which is misleading. It also opens a menulist when a checkbox is clicked, which is not an expected behavior and can shift focus. This refactors the "Note format" section to be a vbox container with es and labels, which is more correct semantically and does not confuse screen readers. In addition, when a chekbox is clicked, dispatch a "change" event instead of unnecessarily open up a menu. --- .../zotero/preferences/preferences_export.jsx | 6 +-- .../preferences/preferences_export.xhtml | 48 +++++++------------ scss/preferences/_export.scss | 22 +++++++-- 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_export.jsx b/chrome/content/zotero/preferences/preferences_export.jsx index a76e13aa90..6b193c776c 100644 --- a/chrome/content/zotero/preferences/preferences_export.jsx +++ b/chrome/content/zotero/preferences/preferences_export.jsx @@ -258,9 +258,9 @@ Zotero_Preferences.Export = { } item.value = JSON.stringify(format); } - // After updating menulist item value we have to wait a bit before doing click(), to avoid anomalies - // like an empty row in menulist. 0 in setTimeout is not enough - setTimeout(() => menulist.click(), 50); + // After updating item's value we have to wait before dispatching event. + // menulist.value does not reflect changes immediately item.value is updated. + setTimeout(() => menulist.dispatchEvent(new Event("change", { bubbles: true })), 50); }, diff --git a/chrome/content/zotero/preferences/preferences_export.xhtml b/chrome/content/zotero/preferences/preferences_export.xhtml index 0af96f7924..04bfe144e0 100644 --- a/chrome/content/zotero/preferences/preferences_export.xhtml +++ b/chrome/content/zotero/preferences/preferences_export.xhtml @@ -53,38 +53,22 @@