states - aria selected/expanded

This commit is contained in:
Milos Brzakovic (E-Search)
2021-11-30 14:28:43 +01:00
parent 041332045d
commit e91dc1b4f6
4 changed files with 9 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ export function uiDisclosure(context, key, expandedDefault) {
hideToggle
.on('click', toggle)
.attr('title', t(`icons.${_expanded ? 'collapse' : 'expand'}`))
.attr('aria-expanded', _expanded)
.classed('expanded', _expanded);
hideToggle.selectAll('.hide-toggle-text')
@@ -85,6 +86,7 @@ export function uiDisclosure(context, key, expandedDefault) {
hideToggle
.classed('expanded', _expanded)
.attr('aria-expanded', _expanded)
.attr('title', t(`icons.${_expanded ? 'collapse' : 'expand'}`));
hideToggle.selectAll('.hide-toggle-icon')

View File

@@ -77,6 +77,7 @@ export function uiGeolocate(context) {
function updateButtonState() {
_button.classed('active', _layer.enabled());
_button.attr('aria-selected', _layer.enabled());
}
return function(selection) {
@@ -85,6 +86,7 @@ export function uiGeolocate(context) {
_button = selection
.append('button')
.on('click', click)
.attr('aria-selected', false)
.call(svgIcon('#iD-icon-geolocate', 'light'))
.call(uiTooltip()
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')

View File

@@ -95,13 +95,15 @@ export function uiSectionRawTagEditor(id, context) {
.attr('class', function(d) {
return 'raw-tag-option raw-tag-option-' + d.id + (_tagView === d.id ? ' selected' : '');
})
.attr('aria-selected', function(d) { return _tagView === d.id; })
.attr('title', function(d) { return t('icons.' + d.id); })
.on('click', function(d3_event, d) {
_tagView = d.id;
prefs('raw-tag-editor-view', d.id);
wrap.selectAll('.raw-tag-option')
.classed('selected', function(datum) { return datum === d; });
.classed('selected', function(datum) { return datum === d; })
.attr('aria-selected', function(datum) { return datum === d; });
wrap.selectAll('.tag-text')
.classed('hide', (d.id !== 'text'))

View File

@@ -137,7 +137,9 @@ export function uiToolOldDrawModes(context) {
// update
buttons = buttons
.merge(buttonsEnter)
.attr('aria-disabled', function(d) { return !enabled(d); })
.classed('disabled', function(d) { return !enabled(d); })
.attr('aria-selected', function(d) { return context.mode() && context.mode().button === d.button; })
.classed('active', function(d) { return context.mode() && context.mode().button === d.button; });
}
};