Skip to content
Snippets Groups Projects
Commit 396c137e authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

Revert "set aria-disabled as well on helper attributes [data-(de)activates], fixes #1200"

This reverts commit 8c91f589.
parent 8c91f589
No related branches found
No related tags found
No related merge requests found
...@@ -98,13 +98,11 @@ $(document).on('change', '[data-activates],[data-deactivates]', function() { ...@@ -98,13 +98,11 @@ $(document).on('change', '[data-activates],[data-deactivates]', function() {
var state = $(this).prop('checked') || $(this).prop('indeterminate') || false; var state = $(this).prop('checked') || $(this).prop('indeterminate') || false;
$(selector).each(function() { $(selector).each(function() {
const condition = $(this).data(`${type}Condition`); var condition = $(this).data(`${type}Condition`),
const toggle = state && (!condition || $(condition).length > 0); toggle = state && (!condition || $(condition).length > 0);
const disabled = type === 'activates' ? !toggle : toggle; $(this)
$(this).attr({ .attr('disabled', type === 'activates' ? !toggle : toggle)
disabled: disabled, .trigger('update.proxy');
'aria-disabled': disabled ? 'true' : 'false'
}).trigger('update.proxy');
}); });
}); });
}); });
...@@ -117,12 +115,9 @@ STUDIP.ready((event) => { ...@@ -117,12 +115,9 @@ STUDIP.ready((event) => {
// element. Define element to disable if select has a value different from // element. Define element to disable if select has a value different from
// an empty string by a css selector in attribute "data-activates". // an empty string by a css selector in attribute "data-activates".
$(document).on('change update.proxy', 'select[data-activates]', function() { $(document).on('change update.proxy', 'select[data-activates]', function() {
const activates = $(this).data('activates'); var activates = $(this).data('activates'),
const disabled = $(this).is(':disabled') || $(this).val().length === 0; disabled = $(this).is(':disabled') || $(this).val().length === 0;
$(activates).attr({ $(activates).attr('disabled', disabled);
disabled: disabled,
'aria-disabled': disabled ? 'true' : 'false'
});
}); });
STUDIP.ready((event) => { STUDIP.ready((event) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment