fix(date-picker): stop "Escape" from closing modal (#955)

Fixes #952
This commit is contained in:
Eric Liu 2021-12-29 06:02:55 -08:00 committed by GitHub
commit a522a55596
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -234,6 +234,12 @@
{datePickerType === 'range' && {datePickerType === 'range' &&
$labelTextEmpty && $labelTextEmpty &&
'bx--date-picker--nolabel'}" 'bx--date-picker--nolabel'}"
on:keydown="{(e) => {
if (calendar?.isOpen && e.key === 'Escape') {
e.stopPropagation();
calendar.close();
}
}}"
> >
<slot /> <slot />
</div> </div>