Merge pull request #1829 from cryptpad/plugin-decrees

Accessibility fixes to Admin UI
This commit is contained in:
yflory 2025-03-17 15:10:59 +01:00 committed by GitHub
commit 806666d1b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -146,6 +146,8 @@ define(req, function(AppConfig, Default, Language) {
Messages.admin_addAdminsHint = "Add administrators from their public key or from your contacts list";
Messages.admin_addAdminsAdd = "Promote a contact to admin";
Messages.admin_addKeyLabel = "Add an admin using their public key";
Messages.admin_errorAddKeyLabel = "Add a valid public key";
Messages.admin_errorAddAdmins = "Pick a contact to promote to admin";
Messages.admin_listName = "Admin name";
Messages.admin_listKey = "Admin key";

View File

@ -346,7 +346,9 @@ define([
Util.onClickEnter($keyBtn, () => {
let val = $keyInput.val().trim();
let key = Keys.canonicalize(val);
if (!key) { return; }
if (!key) {
return UI.warn(Messages.admin_errorAddKeyLabel);
}
// We have a valid key
let name = Messages.admin_admin;
try {
@ -388,6 +390,9 @@ define([
let addBtn = blocks.button('primary', 'fa-plus', Messages.tag_add);
Util.onClickEnter($(addBtn), () => {
var $sel = $(contactsGrid.div).find('.cp-usergrid-user.cp-selected');
if (!$sel.length) {
return UI.warn(Messages.admin_errorAddAdmins);
}
nThen((waitFor) => {
$sel.each((i, el) => {
const $el = $(el);

View File

@ -64,7 +64,7 @@ define([
let prefix = icon.slice(0, icon.indexOf('-'));
cls = `.${prefix}.${icon}`;
}
return h(`i${cls}`);
return h(`i${cls}`, { 'aria-hidden': 'true' });
};
blocks.button = (type, icon, text) => {
type = type || 'primary';