Skip to content

Commit

Permalink
states - aria selected/expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrzakovic committed Nov 30, 2021
1 parent 0413320 commit e91dc1b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/ui/disclosure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions modules/ui/geolocate.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export function uiGeolocate(context) {

function updateButtonState() {
_button.classed('active', _layer.enabled());
_button.attr('aria-selected', _layer.enabled());
}

return function(selection) {
Expand All @@ -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')
Expand Down
4 changes: 3 additions & 1 deletion modules/ui/sections/raw_tag_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions modules/ui/tools/modes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; });
}
};
Expand Down

0 comments on commit e91dc1b

Please sign in to comment.