Skip to content

Commit 72cc265

Browse files
committed
Improve roles of inventory items with drop-down menu
1 parent 9573215 commit 72cc265

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
- Added: Customizable announcement description using assistive technology when pressing a hotkey (see help in menu).
6868
- Added: Customizable announcement description using assistive technology when shaking device (see help in menu).
6969
- Added: Inventory panel links that do not perform any actions have the aria-disabled attribute, which indicates that there is no associated action but does not suppress the element focusability.
70-
- Added: Designation for assistive technologies whether an inventory item has a drop-down list.
71-
- Changed: Each link in the drop-down menu of an inventory item has the role of a list item.
70+
- Added: Designation for assistive technologies whether an inventory item has a drop-down menu.
71+
- Changed: Each link in the drop-down menu of an inventory item has the role of a menu item.
7272
- Changed: Text labels for player graphic icons.
7373
- Fixed: Links in game text are not focusable with keyboard, and do not have link role.
7474
- Fixed: Incorrect paragraph representation in game text for screen readers.

js/Client.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -350,26 +350,16 @@ Client.prototype.drawItem = function (itemName, quantity) {
350350

351351
var li = $('<li>').addClass('dropdown-submenu');
352352
var liLink = $('<a href="#" class="item_use">');
353-
liLink.attr('aria-haspopup', 'listbox');
353+
liLink.attr('aria-haspopup', 'menu');
354354
if (htmlContent) {
355355
liLink.html(itemDisplayName);
356356
htmlContent = false;
357357
} else {
358358
liLink.text(itemDisplayName);
359359
}
360360
li.append(liLink);
361-
/**
362-
* To improve accessibility, the semantics are modified here using WAI-ARIA.
363-
* The original layout consists of a list, a single list item,
364-
* and links within the list item. For assistive technologies,
365-
* each link is made a list item (see comments on specific lines of code).
366-
* In the future, everything can be brought to a single layout
367-
* if the graphic design is adapted.
368-
*/
369-
// A11Y modification: Remove list semantics using the presentation role
370-
var ul = $('<ul role="presentation" class="dropdown-menu">');
371-
// A11Y modification: Redefine the list item semantics as a list using the list role
372-
var li2 = $('<li role="list" class="menu-item">');
361+
var ul = $('<ul role="menu" class="dropdown-menu">');
362+
var li2 = $('<li role="presentation" class="menu-item">');
373363

374364
var li2link;
375365
for (var i = 0; i < actions.length; i++) {
@@ -387,16 +377,14 @@ var ul = $('<ul role="presentation" class="dropdown-menu">');
387377
actionDisplayName = actions[i][0].replace(/_/g, ' ');
388378
}
389379

390-
li2link = $('<a href="#" class="item_use">');
380+
li2link = $('<a role="menuitem" href="#" class="item_use">');
391381
li2link.attr('data-label', actions[i][1]);
392382
if (htmlContent) {
393383
li2link.html(actionDisplayName);
394384
htmlContent = false;
395385
} else {
396386
li2link.text(actionDisplayName);
397387
}
398-
// A11Y modification: Place links in elements with the list item role
399-
li2link = $('<span role="listitem">').append(li2link);
400388
li2.append(li2link);
401389
}
402390
}

md/ru/other/changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
- Добавлено: Настраиваемое объявление описания с помощью вспомогательных технологий при нажатии горячей клавиши (см. справку в меню).
6868
- Добавлено: Настраиваемое объявление описания с помощью вспомогательных технологий при встряхивании устройства.
6969
- Добавлено: Ссылки на панели инвентаря, не выполняющие никаких действий, имеют атрибут aria-disabled, который информирует об отсутствии связанных действий, но не подавляет фокусируемость элемента.
70-
- Добавлено: Обозначение для вспомогательных технологий наличия выпадающего списка у элемента инвентаря.
71-
- Изменено: Каждая ссылка в выпадающем меню элемента инвентаря имеет роль элемента списка.
70+
- Добавлено: Обозначение для вспомогательных технологий наличия выпадающего меню у элемента инвентаря.
71+
- Изменено: Каждая ссылка в выпадающем меню элемента инвентаря имеет роль пункта меню.
7272
- Изменено: Текстовые метки у графических иконок плеера.
7373
- Исправлено: Ссылки в тексте игры не фокусируются с клавиатуры, а также не имеют роль ссылки.
7474
- Исправлено: Некорректное представление абзацев в тексте игры для программ экранного доступа.

0 commit comments

Comments
 (0)