Don't focus search bar on touch screens
This commit is contained in:
parent
e6dc365632
commit
401e5bda08
7
src/functions/touch.ts
Normal file
7
src/functions/touch.ts
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Check if the device is touch enabled
|
||||
* @returns {boolean} True if the device is touch enabled, otherwise false
|
||||
*/
|
||||
export function isTouch(): boolean {
|
||||
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
||||
}
|
@ -23,6 +23,7 @@ import { Button, MySwitch } from "./components/button";
|
||||
import MyDialog from "./components/dialog";
|
||||
import { exportToExcel } from "./functions/export";
|
||||
import { Link } from "./components/link";
|
||||
import { isTouch } from "./functions/touch";
|
||||
|
||||
type Option = { name: string, value: "NONE" | "TRUE" | "FALSE" | "DEFAULT" | "TRUE_FIRST" | "FALSE_FIRST" };
|
||||
|
||||
@ -41,9 +42,10 @@ const TruthTablePage: Component = () => {
|
||||
if (searchParams.has("exp")) {
|
||||
inputContent = true;
|
||||
}
|
||||
if (searchParams.has("hideIntermediate")) {
|
||||
hideIntermediate = searchParams.get("hideIntermediate") === "true";
|
||||
} }
|
||||
if (searchParams.has("hideIntermediate")) {
|
||||
hideIntermediate = searchParams.get("hideIntermediate") === "true";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the boolean value of the simplify toggle
|
||||
@ -160,7 +162,9 @@ hideIntermediate=${ hideIntermediates() }`)
|
||||
}
|
||||
|
||||
// Focuses searchbar on load
|
||||
getInputElement()?.focus();
|
||||
if (!isTouch()) {
|
||||
getInputElement()?.focus();
|
||||
}
|
||||
});
|
||||
|
||||
function _exportToExcel(): void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user