mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 01:06:35 +00:00
Fix: Quick Bar not launching on windows (#7293)
This commit is contained in:
parent
5cddb482f1
commit
5de225d5d4
@ -11,13 +11,15 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isMacOS = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
|
||||||
|
|
||||||
export default <T extends Constructor<HassElement>>(superClass: T) =>
|
export default <T extends Constructor<HassElement>>(superClass: T) =>
|
||||||
class extends superClass {
|
class extends superClass {
|
||||||
protected firstUpdated(changedProps: PropertyValues) {
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
|
|
||||||
document.addEventListener("keydown", (e: KeyboardEvent) => {
|
document.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||||
if (e.code === "KeyP" && e.metaKey) {
|
if (this.isOSCtrlKey(e) && e.code === "KeyP") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const eventParams: QuickBarParams = {};
|
const eventParams: QuickBarParams = {};
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
@ -28,4 +30,8 @@ export default <T extends Constructor<HassElement>>(superClass: T) =>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isOSCtrlKey(e: KeyboardEvent) {
|
||||||
|
return isMacOS ? e.metaKey : e.ctrlKey;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user