Skip to content

Commit

Permalink
browser: accessibility: add 'aria-expanded' to the button
Browse files Browse the repository at this point in the history
https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/

Change-Id: I4dd17d7c213aa5130178de00a98efccd613823d1
Signed-off-by: Henry Castro <hcastro@collabora.com>
  • Loading branch information
hcvcastro committed Jan 28, 2025
1 parent 792b20c commit 8b95ff8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions browser/src/control/Control.JSDialogBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,17 +730,19 @@ L.Control.JSDialogBuilder = L.Control.extend({
builder.postProcess(expander, data.children[0]);

var state = data.children.length > 1 && expanded;
$(label).addClass('expanded', state);
label.setAttribute('aria-expanded', state);
if (state) {
L.DomUtil.addClass(label, 'expanded');
}
expander.setAttribute('aria-expanded', state);

var toggleFunction = function () {
if (customCallback)
customCallback();
else
builder.callback('expander', 'toggle', data, null, builder);

var state = Boolean(label.getAttribute('aria-expanded'));
label.setAttribute('aria-expanded', !state);
var state = Boolean(expander.getAttribute('aria-expanded'));
expander.setAttribute('aria-expanded', !state);
$(label).toggleClass('expanded');
$(expander).siblings().toggleClass('expanded');
};
Expand Down

0 comments on commit 8b95ff8

Please sign in to comment.