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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Result Box Won't Hide After Clicking Outside #25

Open
PraveenShinde3 opened this issue Jun 11, 2024 · 0 comments
Open

Search Result Box Won't Hide After Clicking Outside #25

PraveenShinde3 opened this issue Jun 11, 2024 · 0 comments

Comments

@PraveenShinde3
Copy link

PraveenShinde3 commented Jun 11, 2024

Search Result Box Won't Hide After Clicking Outside

Description

The search result box remains visible even after clicking outside of it. This issue affects the user experience by cluttering the interface and potentially causing confusion.

Steps to Reproduce

  1. Type a query into the search bar.
  2. Observe the search results box appearing below the search bar.
  3. Click anywhere outside the search results box.

Expected Behavior

The search result box should hide when clicking outside of it.
Expected-Example.webm

example website : https://certificatehub.vercel.app/

Actual Behavior

The search result box remains visible despite clicking outside of it.
Actual.webm

Suggested Fix

Implement an event listener to detect clicks outside the search result box and hide it accordingly.

const [isVisible, setIsVisible] = useState(false);
  const ref = useRef(null);

  const handleClickOutside = (event) => {
    if (ref.current && !ref.current.contains(event.target)) {
      setIsVisible(false);
    }
  };
@PraveenShinde3 PraveenShinde3 changed the title Bug Report: Search Result Box Won't Hide After Clicking Outside Search Result Box Won't Hide After Clicking Outside Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant