mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-06 15:07:25 +02:00
Clickable tags use HMTL button
Tags that open modals or trigger other actions need to be accessible for keyboard and assistive technologies.
This commit is contained in:
2
gradle/changelog/accessible_clickable_tags.yaml
Normal file
2
gradle/changelog/accessible_clickable_tags.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: changed
|
||||
description: Clickable tags are based on the HTML button.
|
||||
@@ -45,7 +45,7 @@ const Tag: FC<Props> = ({
|
||||
title,
|
||||
onClick,
|
||||
onRemove,
|
||||
children
|
||||
children,
|
||||
}) => {
|
||||
const [t] = useTranslation("commons");
|
||||
|
||||
@@ -53,7 +53,7 @@ const Tag: FC<Props> = ({
|
||||
if (icon) {
|
||||
showIcon = (
|
||||
<>
|
||||
<i className={classNames("fas", `fa-${icon}`)} />
|
||||
<i className={classNames("fas", `fa-${icon}`)} aria-hidden="true" />
|
||||
|
||||
</>
|
||||
);
|
||||
@@ -65,26 +65,44 @@ const Tag: FC<Props> = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<span
|
||||
className={classNames(
|
||||
"tag",
|
||||
`is-${color}`,
|
||||
`is-${size}`,
|
||||
className,
|
||||
{
|
||||
"is-outlined": outlined,
|
||||
"is-rounded": rounded,
|
||||
"is-clickable": onClick
|
||||
},
|
||||
size === "small" && smallClassNames
|
||||
)}
|
||||
title={title}
|
||||
onClick={onClick}
|
||||
>
|
||||
{showIcon}
|
||||
{label}
|
||||
{children}
|
||||
</span>
|
||||
{onClick === undefined ? (
|
||||
<span
|
||||
className={classNames(
|
||||
"tag",
|
||||
`is-${color}`,
|
||||
`is-${size}`,
|
||||
className,
|
||||
{
|
||||
"is-outlined": outlined,
|
||||
"is-rounded": rounded,
|
||||
},
|
||||
size === "small" && smallClassNames
|
||||
)}
|
||||
>
|
||||
{showIcon}
|
||||
{label}
|
||||
{children}
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
className={classNames(
|
||||
"tag",
|
||||
`is-${color}`,
|
||||
`is-${size}`,
|
||||
className,
|
||||
{
|
||||
"is-outlined": outlined,
|
||||
"is-rounded": rounded,
|
||||
},
|
||||
size === "small" && smallClassNames
|
||||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
{showIcon}
|
||||
{label}
|
||||
{children}
|
||||
</button>
|
||||
)}
|
||||
{showDelete}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -77735,6 +77735,13 @@ exports[`Storyshots Secondary Navigation Active when match 1`] = `
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
className="SecondaryNavigation__Icon-sc-8p1rgi-1 gqxbcY is-medium"
|
||||
>
|
||||
<i
|
||||
className="fas fa-caret-down"
|
||||
/>
|
||||
</i>
|
||||
Hitchhiker
|
||||
</button>
|
||||
<ul
|
||||
@@ -84523,12 +84530,12 @@ exports[`Storyshots Tag Clickable 1`] = `
|
||||
<div
|
||||
className="Tagstories__Wrapper-sc-wsn8kx-0 TvLrx"
|
||||
>
|
||||
<span
|
||||
className="tag is-light is-normal is-clickable"
|
||||
<button
|
||||
className="tag is-light is-normal"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Click here
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -84744,6 +84751,7 @@ exports[`Storyshots Tag With Icon 1`] = `
|
||||
className="tag is-light is-normal"
|
||||
>
|
||||
<i
|
||||
aria-hidden="true"
|
||||
className="fas fa-bolt"
|
||||
/>
|
||||
|
||||
@@ -84758,7 +84766,6 @@ exports[`Storyshots Tag With title 1`] = `
|
||||
>
|
||||
<span
|
||||
className="tag is-light is-normal"
|
||||
title="good job"
|
||||
>
|
||||
hover me
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user