Skip to content

Commit

Permalink
Gallery - fix Axe errors (#25540)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderPolosatov authored Sep 29, 2023
1 parent 9ecb391 commit ecf1dc2
Show file tree
Hide file tree
Showing 30 changed files with 252 additions and 44 deletions.
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Mostrar recursos",
"dxGantt-showDependencies": "Mostrar dependències",
"dxGantt-dialogStartDateValidation": "La data d'inici ha de ser després de {0}",
"dxGantt-dialogEndDateValidation": "La data de finalització ha de ser després de {0}"
"dxGantt-dialogEndDateValidation": "La data de finalització ha de ser després de {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Ressourcen Anzeigen",
"dxGantt-showDependencies": "Abhängigkeiten Anzeigen",
"dxGantt-dialogStartDateValidation": "Startdatum muss später sein als {0}",
"dxGantt-dialogEndDateValidation": "Enddatum muss später sein als {0}"
"dxGantt-dialogEndDateValidation": "Enddatum muss später sein als {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Mostrar Recursos",
"dxGantt-showDependencies": "Mostrar Dependencias",
"dxGantt-dialogStartDateValidation": "La fecha de inicio debe ser anterior {0}",
"dxGantt-dialogEndDateValidation": "La fecha de finalización debe ser posterior {0}"
"dxGantt-dialogEndDateValidation": "La fecha de finalización debe ser posterior {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Afficher les ressources",
"dxGantt-showDependencies": "Afficher les dépendances",
"dxGantt-dialogStartDateValidation": "La date de début doit être postérieure au {0}",
"dxGantt-dialogEndDateValidation": "La date de fin doit être postérieure au {0}"
"dxGantt-dialogEndDateValidation": "La date de fin doit être postérieure au {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "リソースを表示",
"dxGantt-showDependencies": "依存関係を表示",
"dxGantt-dialogStartDateValidation": "開始日を {0} 以降にする必要があります",
"dxGantt-dialogEndDateValidation": "終了日は {0} より後にする必要があります"
"dxGantt-dialogEndDateValidation": "終了日は {0} より後にする必要があります",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Rodyti resursus",
"dxGantt-showDependencies": "Rodyti priklausomybes",
"dxGantt-dialogStartDateValidation": "Pradžios data turi būti po {0}",
"dxGantt-dialogEndDateValidation": "Pabaigos data turi būti po {0}"
"dxGantt-dialogEndDateValidation": "Pabaigos data turi būti po {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/lv.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Rādīt Resursus",
"dxGantt-showDependencies": "Rādīt Sasaistes",
"dxGantt-dialogStartDateValidation": "Sākuma datumam jābūt vēlākam par {0}",
"dxGantt-dialogEndDateValidation": "Beigu datumam jābūt vēlākam par {0}"
"dxGantt-dialogEndDateValidation": "Beigu datumam jābūt vēlākam par {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Mostrar recursos",
"dxGantt-showDependencies": "Mostrar dependências",
"dxGantt-dialogStartDateValidation": "A data de início deve ser após {0}",
"dxGantt-dialogEndDateValidation": "A data de término deve ser posterior a {0}"
"dxGantt-dialogEndDateValidation": "A data de término deve ser posterior a {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Отображать Ресурсы",
"dxGantt-showDependencies": "Отображать Зависимости",
"dxGantt-dialogStartDateValidation": "Начальная дата должна быть позднее {0}",
"dxGantt-dialogEndDateValidation": "Конечная дата должна быть позднее {0}"
"dxGantt-dialogEndDateValidation": "Конечная дата должна быть позднее {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
4 changes: 3 additions & 1 deletion packages/devextreme/js/localization/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"dxGantt-showResources": "Show Resources",
"dxGantt-showDependencies": "Show Dependencies",
"dxGantt-dialogStartDateValidation": "Start date must be after {0}",
"dxGantt-dialogEndDateValidation": "End date must be after {0}"
"dxGantt-dialogEndDateValidation": "End date must be after {0}",

"dxGallery-itemName": "Gallery item"
}
}
20 changes: 14 additions & 6 deletions packages/devextreme/js/ui/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Swipeable from '../events/gesture/swipeable';
import { BindableTemplate } from '../core/templates/bindable_template';
import { Deferred } from '../core/utils/deferred';
import { triggerResizeEvent } from '../events/visibility_change';
import messageLocalization from '../localization/message';

// STYLE gallery

Expand Down Expand Up @@ -146,7 +147,10 @@ const Gallery = CollectionWidget.inherit({
*/


_itemAttributes: { role: 'option' },
_itemAttributes: {
role: 'option',
'aria-label': messageLocalization.format('dxGallery-itemName')
},
loopItemFocus: false,
selectOnFocus: true,
selectionMode: 'single',
Expand Down Expand Up @@ -273,10 +277,13 @@ const Gallery = CollectionWidget.inherit({

this.callBase();

this.setAria({
'role': 'listbox',
const useListBoxRole = this._itemsCount() > 0;
const ariaAttrs = {
'role': useListBoxRole ? 'listbox' : undefined,
'label': 'gallery'
});
};

this.setAria(ariaAttrs);
},

_render: function() {
Expand Down Expand Up @@ -392,10 +399,11 @@ const Gallery = CollectionWidget.inherit({
const $clonedItem = $(item)
.clone(false)
.addClass(GALLERY_LOOP_ITEM_CLASS)
.removeAttr('id')
.css('margin', 0)
.appendTo($container);

this.setAria({ role: 'presentation' }, $clonedItem);
this.setAria({ hidden: true }, $clonedItem);
}
},

Expand Down Expand Up @@ -946,7 +954,7 @@ const Gallery = CollectionWidget.inherit({
_setFocusOnSelect: function() {
this._userInteraction = true;

const selectedItem = this.itemElements().filter('.' + GALLERY_ITEM_SELECTED_CLASS);
const selectedItem = this._getRealItems().filter('.' + GALLERY_ITEM_SELECTED_CLASS);
this.option('focusedElement', getPublicElement(selectedItem));
this._userInteraction = false;
},
Expand Down
Loading

0 comments on commit ecf1dc2

Please sign in to comment.