Add keyboard navigation to repository overview list (#2146)

A new api is introduced to allow focus-based list iteration through keyboard shortcuts. The api is initially considered closed and only used in the repository overview.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
Konstantin Schaper
2022-11-04 18:05:16 +01:00
committed by GitHub
parent 7b933c6821
commit e74d0c9c8b
12 changed files with 469 additions and 27 deletions

View File

@@ -26,6 +26,7 @@ import { Link } from "react-router-dom";
import classNames from "classnames";
import styled from "styled-components";
import { useTranslation } from "react-i18next";
import { useKeyboardIteratorTarget } from "@scm-manager/ui-shortcuts";
const StyledGroupEntry = styled.div`
max-height: calc(90px - 1.5rem);
@@ -82,9 +83,11 @@ type Props = {
const GroupEntry: FC<Props> = ({ link, avatar, title, name, description, contentRight, ariaLabel }) => {
const [t] = useTranslation("repos");
const ref = useKeyboardIteratorTarget();
return (
<div className="is-relative">
<OverlayLink
ref={ref}
to={link}
className="has-hover-background-blue"
aria-label={t("overview.ariaLabel", { name: ariaLabel })}