vpat 46: remaining aria-labels in preferences (#4006)

- Linked remaining found inputs/menulists to their labels.
- Made the "Choose resolver" a proper visible
label, so that it does not oddly disappear if you click
on the dropdown with "Custom" showing after even if the
selection did not change. For the purpose of VPAT, a
visible label is always good for success criteria 3.3.2
https://www.w3.org/WAI/WCAG21/Understanding/labels-or-instructions
- Added explicit names to +/- buttons
- aria-labelledBy for inputs surrounded by text
- fluent strings for resolver preferences
- remove openURL.version preference, hardcode "1.0"
This commit is contained in:
abaevbog 2024-06-05 23:00:33 -05:00 committed by GitHub
parent 094b8157af
commit c07a13fcfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 54 additions and 60 deletions

View file

@ -56,6 +56,7 @@
<html:link rel="localization" href="branding/brand.ftl"/>
<html:link rel="localization" href="zotero.ftl"/>
<html:link rel="localization" href="preferences.ftl"/>
<html:link rel="localization" href="zotero.ftl"/>
</linkset>
<script>

View file

@ -170,7 +170,7 @@
<groupbox>
<hbox>
<hbox align="center">
<label value="&zotero.preferences.feeds.sorting.label;"/>
<label value="&zotero.preferences.feeds.sorting.label;" control="feed-sort"/>
<menulist id="feed-sort" preference="extensions.zotero.feeds.sortAscending" native="true">
<menupopup>
<menuitem label="&zotero.preferences.feeds.sorting.newest;" value="false"/>
@ -185,23 +185,26 @@
<label><html:h2>&zotero.preferences.feeds.feedDefaults;</html:h2></label>
<hbox>
<hbox align="center">
<label value="&zotero.feedSettings.refresh.label1;"/>
<html:input class="html-input" type="number" min="1" step="1" size="3" data-preference="feeds.defaultTTL"/>
<label value="&zotero.feedSettings.refresh.label2;"/>
<label id="zotero-prefpane-feeds-refresh-label1" value="&zotero.feedSettings.refresh.label1;"/>
<html:input class="html-input" type="number" min="1" step="1" size="3" data-preference="feeds.defaultTTL"
aria-labelledby="zotero-prefpane-feeds-refresh-label1 zotero-prefpane-feeds-refresh-label2"/>
<label id="zotero-prefpane-feeds-refresh-label2" value="&zotero.feedSettings.refresh.label2;"/>
</hbox>
</hbox>
<hbox>
<hbox align="center">
<label value="&zotero.feedSettings.cleanupReadAfter.label1;"/>
<html:input class="html-input" type="number" min="1" step="1" size="2" data-preference="feeds.defaultCleanupUnreadAfter"/>
<label value="&zotero.feedSettings.cleanupReadAfter.label2;"/>
<label id="zotero-prefpane-feeds-readAfter-label1" value="&zotero.feedSettings.cleanupReadAfter.label1;"/>
<html:input class="html-input" type="number" min="1" step="1" size="2" data-preference="feeds.defaultCleanupUnreadAfter"
aria-labelledby="zotero-prefpane-feeds-readAfter-label1 zotero-prefpane-feeds-readAfter-label2"/>
<label id="zotero-prefpane-feeds-readAfter-label2" value="&zotero.feedSettings.cleanupReadAfter.label2;"/>
</hbox>
</hbox>
<hbox>
<hbox align="center">
<label value="&zotero.feedSettings.cleanupUnreadAfter.label1;"/>
<html:input class="html-input" type="number" min="1" step="1" size="2" data-preference="feeds.defaultCleanupReadAfter"/>
<label value="&zotero.feedSettings.cleanupUnreadAfter.label2;"/>
<label id="zotero-prefpane-feeds-unreadAfter-label1" value="&zotero.feedSettings.cleanupUnreadAfter.label1;"/>
<html:input class="html-input" type="number" min="1" step="1" size="2" data-preference="feeds.defaultCleanupReadAfter"
aria-labelledby="zotero-prefpane-feeds-unreadAfter-label1 zotero-prefpane-feeds-unreadAfter-label2"/>
<label id="zotero-prefpane-feeds-unreadAfter-label2" value="&zotero.feedSettings.cleanupUnreadAfter.label2;"/>
</hbox>
</hbox>
</groupbox>
@ -223,16 +226,16 @@
<separator/>
<html:div class="pref-row">
<html:label>&zotero.preferences.fulltext.textMaxLength;</html:label>
<html:input type="text" size="10" preference="extensions.zotero.fulltext.textMaxLength"/>
<html:label for="fulltext-maxLength">&zotero.preferences.fulltext.textMaxLength;</html:label>
<html:input id="fulltext-maxLength" type="text" size="10" preference="extensions.zotero.fulltext.textMaxLength"/>
<html:label>(&zotero.preferences.default; 500000)</html:label>
</html:div>
<separator class="thin"/>
<html:div class="pref-row">
<html:label>&zotero.preferences.fulltext.pdfMaxPages;</html:label>
<html:input type="text" size="5" preference="extensions.zotero.fulltext.pdfMaxPages"/>
<html:label for="fulltext-pdfMaxPages">&zotero.preferences.fulltext.pdfMaxPages;</html:label>
<html:input id="fulltext-pdfMaxPages" type="text" size="5" preference="extensions.zotero.fulltext.pdfMaxPages"/>
<html:label>(&zotero.preferences.default; 100)</html:label>
</html:div>
</groupbox>

View file

@ -37,9 +37,9 @@
<label is="zotero-text-link"
value="&zotero.preferences.export.getAdditionalStyles;" flex="1"
onclick="Zotero_Preferences.Cite.openStylesPage(); event.preventDefault()"/>
<button disabled="true" id="styleManager-delete" label="-"
<button disabled="true" id="styleManager-delete" data-l10n-id="preferences-minus-btn"
oncommand="Zotero_Preferences.Cite.deleteStyle()"/>
<button label="+" oncommand="Zotero_Preferences.Cite.addStyle()"/>
<button data-l10n-id="preferences-plus-btn" oncommand="Zotero_Preferences.Cite.addStyle()"/>
</hbox>
</groupbox>

View file

@ -35,7 +35,7 @@
<separator/>
<label value="&zotero.preferences.quickCopy.itemFormat;" control="quickCopy-menu"/>
<label value="&zotero.preferences.quickCopy.itemFormat;" control="zotero-quickCopy-menu"/>
<menulist id="zotero-quickCopy-menu" label="&zotero.general.loading;" native="true"/>
<hbox align="center">
@ -96,15 +96,14 @@
<button disabled="true" id="quickCopy-edit" label="&zotero.general.edit;"
onclick="if (!this.disabled) Zotero_Preferences.Export.showQuickCopySiteEditor(true)"/>
<spacer flex="1"/>
<button disabled="true" id="quickCopy-delete" label="-" onclick="if (!this.disabled) Zotero_Preferences.Export.deleteSelectedQuickCopySite()"/>
<button label="+"
onclick="Zotero_Preferences.Export.showQuickCopySiteEditor()"/>
<button disabled="true" id="quickCopy-delete" data-l10n-id="preferences-quickCopy-minus" data-l10n-args='{"label":"-"}' onclick="if (!this.disabled) Zotero_Preferences.Export.deleteSelectedQuickCopySite()"/>
<button data-l10n-id="preferences-quickCopy-plus" data-l10n-args='{"label":"+"}' id="quickCopy-add" onclick="Zotero_Preferences.Export.showQuickCopySiteEditor()"></button>
</hbox>
<hbox align="center">
<label value="&zotero.preferences.quickCopy.dragLimit;"/>
<html:input type="text" preference="extensions.zotero.export.quickCopy.dragLimit" size="3"/>
<label value="&zotero.preferences.items;" flex="1"/>
<label id="zotero-prefpane-quickcopy-draglimit-label1" value="&zotero.preferences.quickCopy.dragLimit;"/>
<html:input aria-labelledby="zotero-prefpane-quickcopy-draglimit-label1 zotero-prefpane-quickcopy-draglimit-label2" type="text" preference="extensions.zotero.export.quickCopy.dragLimit" size="3"/>
<label id="zotero-prefpane-quickcopy-draglimit-label2" value="&zotero.preferences.items;" flex="1"/>
</hbox>
</groupbox>
</vbox>

View file

@ -44,13 +44,15 @@ Zotero_Preferences.General = {
menuitem.setAttribute('label', Zotero.appName);
}
// Set OpenURL resolver drop-down to last-known name
// Set OpenURL resolver drop-down to last-known name or "custom" placeholder
let resolverName = Zotero.getString("general.custom");
if (Zotero.Prefs.get('openURL.resolver')) {
let name = Zotero.Prefs.get('openURL.name');
if (name) {
document.getElementById('openurl-primary-popup').firstChild.setAttribute('label', name);
resolverName = name;
}
}
document.getElementById('openurl-primary-popup').firstChild.setAttribute('label', resolverName);
this.refreshLocale();
this._initItemPaneHeaderUI();
@ -425,20 +427,17 @@ Zotero_Preferences.General = {
var openURLMenu = document.getElementById('openurl-menu');
var openURLServerField = document.getElementById('openURLServerField');
var openURLVersionMenu = document.getElementById('openURLVersionMenu');
// If "Custom" selected, clear URL field
if (event.target.value == "custom") {
Zotero.Prefs.clear('openURL.name');
Zotero.Prefs.set('openURL.resolver', '');
Zotero.Prefs.clear('openURL.version');
openURLServerField.value = '';
openURLServerField.focus();
}
else {
Zotero.Prefs.set('openURL.name', openURLServerField.value = event.target.label);
Zotero.Prefs.set('openURL.resolver', openURLServerField.value = event.target.value);
Zotero.Prefs.set('openURL.version', openURLVersionMenu.value = "1.0");
}
openURLMenu.firstChild.hidePopup();

View file

@ -37,7 +37,7 @@
</hbox>
<hbox align="center">
<label value="&zotero.bibliography.locale.label;"/>
<label value="&zotero.bibliography.locale.label;" control="locale-menu"/>
<menulist id="locale-menu"
onblur="if (!Zotero.isMac) Zotero_Preferences.General.onLocaleChange()"
native="true">
@ -193,38 +193,26 @@
<groupbox>
<label><html:h2>&zotero.preferences.prefpane.locate;</html:h2></label>
<hbox>
<hbox align="center">
<label control="openurl-menu" data-l10n-id="preferences-locate-resolver"></label>
<menulist id="openurl-menu" native="true">
<menupopup
id="openurl-primary-popup"
onpopupshowing="Zotero_Preferences.General.handleOpenURLPopupShowing(event)"
oncommand="Zotero_Preferences.General.handleOpenURLSelected(event)">
<menuitem label="&zotero.preferences.openurl.choose;"/>
<menuitem/>
</menupopup>
</menulist>
</hbox>
<hbox style="display: flex; align-items: center;">
<label id="openUrl-label" value="&zotero.preferences.openurl.server;"/>
<label control="openURLServerField" data-l10n-id="preferences-locate-base-url"/>
<html:input type="text" id="openURLServerField" style="flex: 1;"
aria-labelledby="openURLServerField"
oninput="Zotero_Preferences.General.onOpenURLCustomized();"
preference="extensions.zotero.openURL.resolver"
/>
</hbox>
<hbox align="center">
<label value="&zotero.preferences.openurl.version;" control="openURLVersionMenu"/>
<menulist id="openURLVersionMenu"
oncommand="Zotero_Preferences.General.onOpenURLCustomized();"
preference="extensions.zotero.openURL.version"
native="true">
<menupopup>
<menuitem label="0.1" value="0.1"/>
<menuitem label="1.0" value="1.0"/>
</menupopup>
</menulist>
</hbox>
</groupbox>
<groupbox id="zotero-prefpane-miscellaneous-groupbox">
@ -232,9 +220,9 @@
<checkbox label="&zotero.preferences.automaticTags;" preference="extensions.zotero.automaticTags" native="true"/>
<hbox align="center">
<label id="trashAutoEmpty-label" value="&zotero.preferences.trashAutoEmptyDaysPre;"/>
<html:input aria-labelledby="trashAutoEmpty-label" type="text" size="2" preference="extensions.zotero.trashAutoEmptyDays"/>
<label value="&zotero.preferences.trashAutoEmptyDaysPost;"/>
<label id="trashAutoEmpty-label1" value="&zotero.preferences.trashAutoEmptyDaysPre;"/>
<html:input aria-labelledby="trashAutoEmpty-label1 trashAutoEmpty-label2" type="text" size="2" preference="extensions.zotero.trashAutoEmptyDays"/>
<label id="trashAutoEmpty-label2" value="&zotero.preferences.trashAutoEmptyDaysPost;"/>
</hbox>
</groupbox>

View file

@ -112,6 +112,7 @@
native="true"/>
<menulist id="storage-protocol" class="storage-personal"
style="margin-left: .5em"
aria-label="&zotero.preferences.sync.fileSyncing.myLibrary;"
preference="extensions.zotero.sync.storage.protocol"
oncommand="Zotero_Preferences.Sync.onStorageSettingsChange()"
native="true">
@ -127,7 +128,7 @@
<box style="background: black; opacity:.03"/>
<grid class="form-grid">
<label value="&zotero.preferences.sync.fileSyncing.url;"/>
<label control="storage-url-prefix" value="&zotero.preferences.sync.fileSyncing.url;"/>
<hbox>
<menulist id="storage-url-prefix"
preference="extensions.zotero.sync.storage.scheme"
@ -140,13 +141,14 @@
</menulist>
<label value="://"/>
<html:input id="storage-url" style="flex: 1;"
aria-label="&zotero.preferences.sync.fileSyncing.url;"
preference="extensions.zotero.sync.storage.url"
onkeypress="Zotero_Preferences.Sync.onStorageSettingsKeyPress(event)"
onchange="Zotero_Preferences.Sync.onStorageSettingsChange()"/>
<label value="/zotero/"/>
</hbox>
<label value="&zotero.preferences.sync.username;"/>
<label control="storage-username" value="&zotero.preferences.sync.username;"/>
<hbox>
<html:input id="storage-username"
preference="extensions.zotero.sync.storage.username"
@ -154,7 +156,7 @@
onchange="Zotero_Preferences.Sync.onStorageSettingsChange()"/>
</hbox>
<label value="&zotero.preferences.sync.password;"/>
<label control="storage-password" value="&zotero.preferences.sync.password;"/>
<hbox>
<html:input id="storage-password" type="password"
onkeypress="Zotero_Preferences.Sync.onStorageSettingsKeyPress(event)"
@ -174,7 +176,7 @@
</stack>
<hbox class="storage-settings-download-options" align="center">
<label value="&zotero.preferences.sync.fileSyncing.download;"/>
<label control="storage-user-download-mode" value="&zotero.preferences.sync.fileSyncing.download;"/>
<menulist id="storage-user-download-mode"
class="storage-mode"
preference="extensions.zotero.sync.storage.downloadMode.personal"
@ -196,7 +198,7 @@
native="true"/>
<hbox class="storage-settings-download-options" align="center">
<label value="&zotero.preferences.sync.fileSyncing.download;"/>
<label control="storage-groups-download-mode" value="&zotero.preferences.sync.fileSyncing.download;"/>
<menulist id="storage-groups-download-mode"
class="storage-mode"
preference="extensions.zotero.sync.storage.downloadMode.groups"

View file

@ -2926,7 +2926,7 @@ Zotero.Utilities.Internal.OpenURL = {
resolve: function (item) {
var co = Zotero.OpenURL.createContextObject(
item.toJSON(),
Zotero.Prefs.get("openURL.version")
"1.0"
);
if (co) {
let base = Zotero.Prefs.get("openURL.resolver");

View file

@ -45,11 +45,6 @@
<!ENTITY zotero.preferences.feeds.sorting.oldest "Oldest items first">
<!ENTITY zotero.preferences.feeds.feedDefaults "Feed Defaults">
<!ENTITY zotero.preferences.openurl.choose "Choose a resolver…">
<!ENTITY zotero.preferences.openurl.custom "Custom…">
<!ENTITY zotero.preferences.openurl.server "Resolver:">
<!ENTITY zotero.preferences.openurl.version "Version:">
<!ENTITY zotero.preferences.prefpane.sync "Sync">
<!ENTITY zotero.preferences.sync.username "Username:">
<!ENTITY zotero.preferences.sync.password "Password:">

View file

@ -41,3 +41,11 @@ preferences-item-pane-header-missing-style = Missing style: <{ $shortName }>
preferences-advanced-language-and-region-title = Language and Region
preferences-advanced-enable-bidi-ui =
.label = Enable bidirectional text editing utilities
preferences-quickCopy-plus =
.aria-label = { general-add }
.label = { $label }
preferences-quickCopy-minus =
.aria-label = { general-remove }
.label = { $label }
preferences-locate-resolver = Resolver
preferences-locate-base-url = Base URL

View file

@ -23,7 +23,6 @@ pref("extensions.zotero.triggerProxyAuthentication", true);
// Proxy auth URLs should respond successfully to HEAD requests over HTTP and HTTPS (in case of forced HTTPS requests)
pref("extensions.zotero.proxyAuthenticationURLs", "https://www.acm.org,https://www.ebscohost.com,https://www.sciencedirect.com,https://ieeexplore.ieee.org,https://www.jstor.org,http://www.ovid.com,https://link.springer.com,https://www.tandfonline.com");
pref("extensions.zotero.openURL.resolver","");
pref("extensions.zotero.openURL.version","1.0");
pref("extensions.zotero.automaticSnapshots",true);
pref("extensions.zotero.downloadAssociatedFiles",true);
pref("extensions.zotero.findPDFs.resolvers", '[]');