Bug 28937: (QA follow-up) Accessability improvement

This patch adds a keydown event listener onto the flatpickr instance and
looks for the down arrow key. When such an event is detected we take
that to mean the user wants to keyboard navigate the calendar widget and
so disable the buggy allowInput option allowing keyboard navigation to
work as expected.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2021-09-27 12:48:54 +01:00 committed by Jonathan Druart
parent e5f1ada249
commit 281be1ade3

View file

@ -47,7 +47,12 @@
.addClass("fa fa-fw fa-remove")
.attr("aria-hidden", true)
.attr("aria-label", _("Clear date") )
);
).keydown(function(e) {
var key = (event.keyCode ? event.keyCode : event.which);
if ( key == 40 ) {
instance.set('allowInput',false);
}
});
},
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
@ -66,6 +71,7 @@
validate_date( selectedDates, instance );
},
});
});
</script>
[% END %]