mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
This commit copies the same ARIA attributes that are added to the character count component[1] in the GOV.UK Design System. This means that screen reader users will hear the count message when they stop typing. 1. https://design-system.service.gov.uk/components/character-count/
46 lines
887 B
JavaScript
46 lines
887 B
JavaScript
(function(window) {
|
|
"use strict";
|
|
|
|
window.GOVUK.Modules.UpdateStatus = function() {
|
|
|
|
let getRenderer = $component => response => $component.html(
|
|
response.html
|
|
);
|
|
|
|
this.start = component => {
|
|
|
|
let id = 'update-status';
|
|
|
|
this.$component = $(component);
|
|
this.$textbox = $('#' + this.$component.data('target'));
|
|
|
|
this.$component
|
|
.attr('id', id);
|
|
|
|
this.$textbox
|
|
.attr('aria-described-by', this.$textbox.attr('aria-described-by') + ' ' + id)
|
|
.on('input', this.update)
|
|
.trigger('input');
|
|
|
|
};
|
|
|
|
this.update = () => {
|
|
|
|
$.ajax(
|
|
this.$component.data('updates-url'),
|
|
{
|
|
'method': 'post',
|
|
'data': this.$textbox.parents('form').serialize()
|
|
}
|
|
).done(
|
|
getRenderer(this.$component)
|
|
).fail(
|
|
() => {}
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})(window);
|