Handle textbox without existing aria-described-by

jQuery.attr returns `undefined` if an element does not have an
attribute. We want an empty string, rather than the default of coercing
`undefined` to the string `'undefined'`.
This commit is contained in:
Chris Hill-Scott
2021-01-08 16:05:55 +00:00
parent 638e505432
commit 43e57b7089
2 changed files with 22 additions and 1 deletions

View File

@@ -48,7 +48,14 @@
.attr('id', id);
this.$textbox
.attr('aria-described-by', this.$textbox.attr('aria-described-by') + ' ' + id)
.attr(
'aria-described-by',
(
this.$textbox.attr('aria-described-by') || ''
) + (
this.$textbox.attr('aria-described-by') ? ' ' : ''
) + id
)
.on('input', throttle(this.update, 150))
.trigger('input');