Skip to content

Commit

Permalink
browser: accessibility: add 'aria-disabled' attribute
Browse files Browse the repository at this point in the history
.
Change-Id: Ic71df7415075523c841194902b0f7f1a6177b6b8
Signed-off-by: Henry Castro <hcastro@collabora.com>
  • Loading branch information
hcvcastro committed Feb 5, 2025
1 parent 733474e commit 9234b08
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions browser/src/control/Control.JSDialogBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
spinfield.setAttribute('disabled', 'true');
}

spinfield.setAttribute('aria-disabled', Boolean(data.enabled));

JSDialog.SynchronizeDisabledState(div, [spinfield]);

if (data.readOnly === true)
Expand Down Expand Up @@ -1285,6 +1287,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (data.enabled === 'false' || data.enabled === false)
$(radiobutton).attr('disabled', 'disabled');

radiobutton.setAttribute('aria-disabled', Boolean(data.enabled));

if (data.checked === 'true' || data.checked === true)
$(radiobutton).prop('checked', true);

Expand Down Expand Up @@ -1328,6 +1332,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
checkbox.disabled = true;
}

checkbox.setAttribute('aria-disabled', Boolean(data.enabled));

JSDialog.SynchronizeDisabledState(div, [checkbox]);

checkbox.addEventListener('change', toggleFunction);
Expand Down Expand Up @@ -1552,6 +1558,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (data.enabled === 'false' || data.enabled === false)
$(pushbutton).prop('disabled', true);

pushbutton.setAttribute('aria-disabled', Boolean(data.enabled));

if (customCallback)
pushbutton.onclick = customCallback;
else if (builder._responses[pushbutton.id] !== undefined)
Expand Down Expand Up @@ -2353,6 +2361,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
$(div).removeClass('selected');
}

button.setAttribute('aria-disabled', disabled);

if (disabled)
div.setAttribute('disabled', 'true');
else
Expand All @@ -2373,6 +2383,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
}, this);
}

button.setAttribute('aria-disabled', disabled);

if (disabled) {
div.setAttribute('disabled', 'true');
}
Expand Down
2 changes: 2 additions & 0 deletions browser/src/control/jsdialog/Widget.MenuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ function _menubuttonControl (parentContainer, data, builder) {
}
});

button.setAttribute('aria-disabled', Boolean(data.enabled));

if (data.enabled === false)
button.disabled = true;
} else {
Expand Down

0 comments on commit 9234b08

Please sign in to comment.