Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Commit

Permalink
fix: pop search when touch textarea in Android Chrome (usememos#1700)
Browse files Browse the repository at this point in the history
* fix: pop search when touch textarea

* eslint
  • Loading branch information
CorrectRoadH authored and hu3rror committed May 22, 2023
1 parent 6dd9196 commit aa8eb3d
Showing 1 changed file with 0 additions and 31 deletions.
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

0 comments on commit aa8eb3d

Please sign in to comment.