Skip to content

Add keyboard shortcut ("/" key) to focus search input#380

Open
navidadelpour wants to merge 6 commits intoAPIs-guru:mainfrom
navidadelpour:feature/search-focus-shortcut
Open

Add keyboard shortcut ("/" key) to focus search input#380
navidadelpour wants to merge 6 commits intoAPIs-guru:mainfrom
navidadelpour:feature/search-focus-shortcut

Conversation

@navidadelpour
Copy link
Copy Markdown

Overview

This pull request adds a keyboard shortcut ("/" key) functionality in GraphQL Voyager, enabling users to focus on the search input. This enhancement aims to improve accessibility and empower users to search without relying on mouse interactions.

Peek 2024-01-05 21-20

This commit introduces a new feature that allows users to focus the search input by pressing the "/" key on the keyboard. Upon pressing "/", the search input will be automatically selected, improving accessibility and user experience within the GraphQL Voyager interface.
@navidadelpour
Copy link
Copy Markdown
Author

Hi @IvanGoncharov,

Can you please review this PR and let me know if there is any issue?

Copy link
Copy Markdown
Member

@IvanGoncharov IvanGoncharov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@navidadelpour Good idea 👍
Thank you for PR.

Since we heavily depend on MUI we should use their component to handle hotkeys.
I did a quick googling and found this:
https://github.com/mui/material-ui/pull/10725/files

Can please try the same approach in Voyager?

@navidadelpour
Copy link
Copy Markdown
Author

@IvanGoncharov thanks for reviewing.

I will definitely check that in the next couple of days and let you know when it is updated.

@navidadelpour
Copy link
Copy Markdown
Author

@IvanGoncharov Hi,

I Updated the PR and it's much more simpler. thanks for guidance. I didn't installed the react-event-listener because it's not compatible with react 18 and is archived on Github, I used an alternative package.

Also, as I was checking the PR#10725 you've sent and MUI code, I realized that this PR is not actually merged to the main branch right now. they are using @docsearch/react package and the way the package is implementing this feature is here.

Can you please review again?

@LunaticMuch
Copy link
Copy Markdown
Contributor

@navidadelpour can you actually run tests and lint on your branch? PR tests for linting are failing

@navidadelpour
Copy link
Copy Markdown
Author

Hi @LunaticMuch

Thanks for reminding me. I should have run them before my push! Would you please check again?

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.

3 participants