mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Ignore excessive keydown events in charts (#24523)
* Ignore excessive keydown events in charts * lint
This commit is contained in:
parent
75edc5132b
commit
cdfe4b53bf
@ -108,7 +108,10 @@ export class HaChartBase extends LitElement {
|
|||||||
|
|
||||||
// Add keyboard event listeners
|
// Add keyboard event listeners
|
||||||
const handleKeyDown = (ev: KeyboardEvent) => {
|
const handleKeyDown = (ev: KeyboardEvent) => {
|
||||||
if ((isMac && ev.key === "Meta") || (!isMac && ev.key === "Control")) {
|
if (
|
||||||
|
!this._modifierPressed &&
|
||||||
|
((isMac && ev.key === "Meta") || (!isMac && ev.key === "Control"))
|
||||||
|
) {
|
||||||
this._modifierPressed = true;
|
this._modifierPressed = true;
|
||||||
if (!this.options?.dataZoom) {
|
if (!this.options?.dataZoom) {
|
||||||
this._setChartOptions({ dataZoom: this._getDataZoomConfig() });
|
this._setChartOptions({ dataZoom: this._getDataZoomConfig() });
|
||||||
@ -123,7 +126,10 @@ export class HaChartBase extends LitElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleKeyUp = (ev: KeyboardEvent) => {
|
const handleKeyUp = (ev: KeyboardEvent) => {
|
||||||
if ((isMac && ev.key === "Meta") || (!isMac && ev.key === "Control")) {
|
if (
|
||||||
|
this._modifierPressed &&
|
||||||
|
((isMac && ev.key === "Meta") || (!isMac && ev.key === "Control"))
|
||||||
|
) {
|
||||||
this._modifierPressed = false;
|
this._modifierPressed = false;
|
||||||
if (!this.options?.dataZoom) {
|
if (!this.options?.dataZoom) {
|
||||||
this._setChartOptions({ dataZoom: this._getDataZoomConfig() });
|
this._setChartOptions({ dataZoom: this._getDataZoomConfig() });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user