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

Improve Homepage Search: Automatically Hide Dropdown on Typing #4953

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GarvitDadheech
Copy link

@GarvitDadheech GarvitDadheech commented Jul 27, 2024

Description:

In this update, I have addressed the first task of issue cBioPortal/cbioportal#10754, which required the removal of the dropdown box as soon as the user starts typing in the search box.

Changes Made:

  1. Previous Behavior: The dropdown box would only disappear when the user pressed the Enter or Escape key.
  2. New Behavior: The dropdown box now hides immediately when the user starts typing.

To achieve this, I removed the old code that only hid the dropdown on Enter or Escape key presses. I updated the event handler for the search box to hide the dropdown whenever a keyboard event is detected. This ensures a smoother and more intuitive user experience.

Here's the updated code snippet:

const onKeyDownSearchBox = useCallback(
    (e: React.KeyboardEvent<HTMLInputElement>) => {
        store.setMenuOpen(false); // Hide dropdown on any key press
    },
    []
);

Copy link

netlify bot commented Jul 27, 2024

Deploy Preview for cbioportalfrontend ready!

Name Link
🔨 Latest commit 1076bf8
🔍 Latest deploy log https://app.netlify.com/sites/cbioportalfrontend/deploys/66a870194a982d00073971c4
😎 Deploy Preview https://deploy-preview-4953--cbioportalfrontend.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants