Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 0 additions & 31 deletions web/src/components/HomeSidebar.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 ${
Expand Down