Skip to content

Commit 017dc19

Browse files
fix(marketplace): highlight category chips when keyboard focus is given (#843)
* fix(marketplace): highlight category chips when keyboard focus is given Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> * adding changeset Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> --------- Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
1 parent 7509a73 commit 017dc19

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-marketplace': patch
3+
---
4+
5+
Highlight Category Chip when focus is given through keyboard navigation

workspaces/marketplace/plugins/marketplace/src/components/PluginCard.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import CardActions from '@mui/material/CardActions';
2626
import Skeleton from '@mui/material/Skeleton';
2727
import Stack from '@mui/material/Stack';
2828
import Typography from '@mui/material/Typography';
29+
import { makeStyles } from '@material-ui/core'; // Or @mui/styles if using MUI v5 with JSS
2930

3031
import { MarketplacePlugin } from '@red-hat-developer-hub/backstage-plugin-marketplace-common';
3132

@@ -39,6 +40,16 @@ export interface PluginCardSkeletonProps {
3940

4041
export const PluginCardGrid = ItemCardGrid;
4142

43+
const useStyles = makeStyles(() => ({
44+
pluginCategoryLinkButton: {
45+
fontWeight: 'normal',
46+
padding: '2px 6px',
47+
'&:focus-visible': {
48+
border: `1px solid`,
49+
},
50+
},
51+
}));
52+
4253
export const PluginCardSkeleton = ({ animation }: PluginCardSkeletonProps) => (
4354
<Card variant="outlined">
4455
<CardContent>
@@ -78,6 +89,7 @@ export const PluginCardSkeleton = ({ animation }: PluginCardSkeletonProps) => (
7889

7990
// TODO: add link around card
8091
export const PluginCard = ({ plugin }: { plugin: MarketplacePlugin }) => {
92+
const classes = useStyles();
8193
const navigate = useNavigate();
8294
const [searchParams] = useSearchParams();
8395
const getIndexPath = useRouteRef(rootRouteRef);
@@ -145,7 +157,7 @@ export const PluginCard = ({ plugin }: { plugin: MarketplacePlugin }) => {
145157
plugin.spec.categories[0],
146158
)}
147159
variant="outlined"
148-
style={{ fontWeight: 'normal', padding: '2px 6px' }}
160+
className={classes.pluginCategoryLinkButton}
149161
onClick={e => e.stopPropagation()}
150162
>
151163
{plugin.spec.categories[0]}

0 commit comments

Comments
 (0)