From 3cd7b11eb466f12472f8659a33f03370da9b89fe Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Mon, 4 Oct 2021 18:59:24 +0200 Subject: [PATCH] TimePicker: Close timepicker with esc (#39962) --- .../components/DateTimePickers/TimeRangePicker.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker.tsx index 16e97daec96..5cd99ef46e1 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker.tsx @@ -66,6 +66,20 @@ export class UnthemedTimeRangePicker extends PureComponent { + if (event.code === 'Escape') { + this.onClose(); + } + }; + onClose = () => { this.setState({ isOpen: false }); };