add aria-label to form inputs

This commit is contained in:
daria 2026-03-30 14:40:06 +03:00
parent 1d831fcfd8
commit 281742addd
No known key found for this signature in database
GPG Key ID: 3B75240E6B2F2701
2 changed files with 9 additions and 1 deletions

View File

@ -134,6 +134,11 @@ define(req, function(AppConfig, Default, Language) {
}
};
Messages.form_input_ph_text = "Your answer here"; // XXX used in form input placeholders, should be generic enough to be used in all contexts
Messages.form_input_ph_number = "Enter a number"; // XXX same as above but for number inputs
// text & number were missing from the existing list
// "form_input_ph_email": "email@example.com",
// "form_input_ph_url": "https://example.com",
return Messages;
});

View File

@ -1699,10 +1699,13 @@ define([
var tag = h('input', {
type: opts.type,
step: "any",
placeholder: Messages['form_input_ph_'+opts.type] || ''
'aria-label': Messages['form_input_ph_'+opts.type],
placeholder: Messages['form_input_ph_'+opts.type]
});
var $tag = $(tag);
$tag.on('change keypress keydown', Util.throttle(function () {
let currentVal = $tag.val().trim();
$tag.attr('aria-label', currentVal || Messages['form_input_ph_'+opts.type] || '');
evOnChange.fire();
}, 500));
var cursorGetter;