diff --git a/etc/tsconfig.json b/etc/tsconfig.json index ebd57af..049869a 100644 --- a/etc/tsconfig.json +++ b/etc/tsconfig.json @@ -10,6 +10,7 @@ "target": "ES5", "moduleResolution": "node", "esModuleInterop": true, + "jsxImportSource": "preact", "jsx": "react-jsx", "lib": [ "ES2020", "DOM" ], "typeRoots": ["../src/js/types/globals.d.ts", "../node_modules/@types"], diff --git a/src/js/components/Select/LanguageSelect.tsx b/src/js/components/Select/LanguageSelect.tsx index 45f11b7..c933448 100644 --- a/src/js/components/Select/LanguageSelect.tsx +++ b/src/js/components/Select/LanguageSelect.tsx @@ -42,7 +42,7 @@ export function LanguageSelect() { const ctx = el?.getAttribute("data-context"); if (ctx === "language-select") { const anchor = getNextRef(e, refs)?.current; - anchor.focus(); + anchor?.focus(); } } } diff --git a/src/js/components/Select/Option.tsx b/src/js/components/Select/Option.tsx index 28b3130..2489497 100644 --- a/src/js/components/Select/Option.tsx +++ b/src/js/components/Select/Option.tsx @@ -2,7 +2,7 @@ import type { ReactNode, AnchorHTMLAttributes, ForwardedRef } from "preact/compa type Rest = AnchorHTMLAttributes; type Props = { value: string; - children: ReactNode; + children?: ReactNode; } & Rest; function Component(props: Props, ref: ForwardedRef) { diff --git a/src/js/components/Select/ThemeSelect.tsx b/src/js/components/Select/ThemeSelect.tsx index 4419e2b..34eb1b3 100644 --- a/src/js/components/Select/ThemeSelect.tsx +++ b/src/js/components/Select/ThemeSelect.tsx @@ -36,7 +36,7 @@ export function ThemeSelect() { const ctx = el?.getAttribute("data-context"); if (ctx === "theme-select") { const anchor = getNextRef(e, refs)?.current; - anchor.focus(); + anchor?.focus(); } } } diff --git a/src/js/components/SurahStream/index.tsx b/src/js/components/SurahStream/index.tsx index c19edc0..adf9dc6 100644 --- a/src/js/components/SurahStream/index.tsx +++ b/src/js/components/SurahStream/index.tsx @@ -45,9 +45,8 @@ export function SurahStream({ surahId, localeId, t }: Props) { history.back(); } } - const el = document.activeElement; - el.addEventListener("keydown", onKeyPress); - return () => el.removeEventListener("keydown", onKeyPress); + document.addEventListener("keydown", onKeyPress); + return () => document.removeEventListener("keydown", onKeyPress); }, []); useEffect(() => { diff --git a/src/js/index.tsx b/src/js/index.tsx index e45fabb..3be6c90 100644 --- a/src/js/index.tsx +++ b/src/js/index.tsx @@ -62,15 +62,10 @@ const App = (function () { const [locale, setLocale] = useLocale(); return ( - {/* @ts-expect-error fixme */} - {/* @ts-expect-error fixme */} - {/* @ts-expect-error fixme */} - {/* @ts-expect-error fixme */} - {/* @ts-expect-error fixme */}