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 #5083

Closed
wants to merge 2 commits into from

Conversation

alisman
Copy link
Collaborator

@alisman alisman commented Jan 10, 2025

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
    },
    []
);

@alisman alisman changed the title Dropdown Improve Homepage Search: Automatically Hide Dropdown on Typing Jan 10, 2025
Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for cbioportalfrontend ready!

Name Link
🔨 Latest commit 3b6d3e7
🔍 Latest deploy log https://app.netlify.com/sites/cbioportalfrontend/deploys/678198a61beb8a000803bcf5
😎 Deploy Preview https://deploy-preview-5083.preview.cbioportal.org
📱 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.

@alisman alisman closed this Jan 10, 2025
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

Successfully merging this pull request may close these issues.

2 participants