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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: submit new repo with shortcut #415

Open
2 tasks done
NsdHSO opened this issue Nov 30, 2022 · 6 comments
Open
2 tasks done

Feature: submit new repo with shortcut #415

NsdHSO opened this issue Nov 30, 2022 · 6 comments

Comments

@NsdHSO
Copy link
Contributor

NsdHSO commented Nov 30, 2022

Type of feature

馃崟 Feature

Current behavior

If you want to submit a new repository for suggestions, you can't use shortcuts like cmd+enter/enter or escape to close the popup window

Suggested solution

Here is an example

const handleCmdK = async (e: KeyboardEvent) => {
if (!hasFocus) {
searchBoxRef.current?.focus();
setFocus(true);
const results = await fetchRecommendations("stars", 3, null, searchTerm);
setFetchedData(results);
} else {
searchBoxRef.current?.blur();
setFocus(false);
}
// prevent browser from handling CMD/CTRL + K
e.preventDefault();
};
const useKey = (superKey: string, key: string, target: MutableRefObject<Document>) => {
useKeys([superKey, key], handleCmdK, { target });
};
useKey("ControlLeft", "KeyK", containerRef);
useKey("ControlRight", "KeyK", containerRef);
useKey("MetaRight", "KeyK", containerRef);
useKey("MetaLeft", "KeyK", containerRef);

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@takanome-dev
Copy link
Contributor

I saw that we have headlessui/react. I think it can handle that (accessibility included) and even for the hero search we can use headlessui combobox

@NsdHSO
Copy link
Contributor Author

NsdHSO commented Nov 30, 2022

For the moment in this component we don't use headlessui combobox we use native input. I think if you want can you open a new issue, to see what the other colleagues say

@0-vortex
Copy link
Contributor

I saw that we have headlessui/react. I think it can handle that (accessibility included) and even for the hero search we can use headlessui combobox

We do, we can also leverage radix components

For the moment in this component we don't use headlessui combobox we use native input. I think if you want can you open a new issue, to see what the other colleagues say

It does not make sense to complicate the current solution with keyboard accessibility when the baseline itself is not very accessible. I would agree the keyboard shortcut would be nice to have on top of an already accessible dropdown menu that displays some more information while typing and potential errors inline.

IMHO the UI components we have installed already could take care of a11y and enable this issue to be done, but it should at least mention improving the baseline! 馃崟

@takanome-dev
Copy link
Contributor

We do, we can also leverage radix components

Oh, didn't know about radix, it looks great 馃挴

IMHO the UI components we have installed already could take care of a11y and enable this issue to be done, but it should at least mention improving the baseline! pizza

Yeah using radix react dropdown will fix this issue 馃崟

@Emmauel98
Copy link

How can I contribute to this?

@bdougie
Copy link
Member

bdougie commented Jul 27, 2023

How can I contribute to this?

Do you have any suggestions or approach based on the existing conversation?

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

No branches or pull requests

5 participants