fix: pop search when touch textarea in Android Chrome (#1700)

* fix: pop search when touch textarea

* eslint
pull/1706/head
CorrectRoadH 2 years ago committed by GitHub
parent 56c6f603aa
commit 6bb0b4cd47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,3 @@
import { useEffect } from "react";
import { resolution } from "../utils/layout";
import { useLayoutStore, useUserStore } from "../store/module";
import ShortcutList from "./ShortcutList";
import TagList from "./TagList";
@ -11,35 +9,6 @@ const HomeSidebar = () => {
const userStore = useUserStore();
const showHomeSidebar = layoutStore.state.showHomeSidebar;
useEffect(() => {
let initialized = false;
let lastStatus = layoutStore.state.showHomeSidebar;
const handleWindowResize = () => {
let nextStatus = window.innerWidth < resolution.md;
if (lastStatus !== nextStatus) {
if (!initialized && nextStatus) {
// Don't show sidebar on first load in mobile view.
nextStatus = false;
}
layoutStore.setHomeSidebarStatus(nextStatus);
lastStatus = nextStatus;
}
if (!initialized) {
initialized = true;
return;
}
};
window.addEventListener("resize", handleWindowResize);
handleWindowResize();
return () => {
window.removeEventListener("resize", handleWindowResize);
};
}, []);
return (
<div
className={`fixed md:sticky top-0 left-0 w-full md:w-56 h-full shrink-0 pointer-events-none md:pointer-events-auto z-10 ${

Loading…
Cancel
Save