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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/axe problems #333

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/atoms/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ModeTypes = {
GRAY: "gray",
} as const;

type ModeProp = typeof ModeTypes[keyof typeof ModeTypes];
type ModeProp = (typeof ModeTypes)[keyof typeof ModeTypes];

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
Expand Down Expand Up @@ -369,6 +369,7 @@ export const Button: React.FC<PropsWithChildren<ButtonProps>> = ({
{...props}
className={`wellms-component ${className}`}
role="button"
aria-labelledby="labeldiv"
>
{loading && <Spin color={loadingColor} />}
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/components/atoms/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ export const Input: React.FC<InputProps> = (props) => {
>
<div className={`input-container ${addFilledClass()}`}>
{renderLabel()}
<div className="input-and-fieldset">
<div className="input-and-fieldset" aria-labelledby="labeldiv">
<input
{...props}
{...notInputProps}
id={label ? generateRandomInputId : undefined}
/>
{label ? (
<fieldset className="fieldset">
<fieldset className="fieldset" aria-labelledby="labeldiv">
<legend>
{label}
{required ? "*" : ""}
Expand Down
16 changes: 7 additions & 9 deletions src/components/molecules/CartCard/CartCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export const CartCard: React.FC<CartCardProps> = (props) => {
role="button"
aria-label={t<string>("CartCard.remove")}
tabIndex={0}
aria-labelledby="labeldiv"
>
<IconBin />
</span>
Expand All @@ -266,21 +267,18 @@ export const CartCard: React.FC<CartCardProps> = (props) => {
{!mobile && discount && discount.status !== "granted" && (
<>
<div className="separator"></div>
<div
className="discount-toggle"
onClick={() => setIsDiscountOpen(!isDiscountOpen)}
onKeyUp={() => setIsDiscountOpen(!isDiscountOpen)}
role="button"
aria-label={t<string>("CartCard.addDiscountButton")}
tabIndex={0}
>
<div className="discount-toggle">
<Text size={"12"} noMargin id={uniqueId}>
{t<string>("CartCard.addDiscountButton")}
</Text>
<Button
as="div"
onClick={() => setIsDiscountOpen(!isDiscountOpen)}
onKeyUp={() => setIsDiscountOpen(!isDiscountOpen)}
title="open discount input"
mode={"icon"}
className="open-discount-state-container"
aria-labelledby="labeldiv"
role="button"
>
{isDiscountOpen ? <ArrowOpenIcon /> : <ArrowClosedIcon />}{" "}
</Button>
Expand Down
5 changes: 1 addition & 4 deletions src/components/molecules/CourseCard/CourseCard.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ const Icon1 = () => (
}
tags={
<React.Fragment>
<Badge
onClick={(e) => console.log("onTag click")}
color={"#ff0000"}
>
<Badge onClick={(e) => console.log("onTag click")}>
Bestseller
</Badge>
<Badge color={"#6d6d6d"}>New</Badge>
Expand Down
27 changes: 14 additions & 13 deletions src/components/molecules/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FC, HTMLAttributes, ReactNode } from "react";
import styled, { css, withTheme } from "styled-components";
import { IconText, Text } from "../../..";
import { getStylesBasedOnTheme } from "../../../utils/utils";
import chroma from "chroma-js";
export interface ListItemProps {
id: number;
text: string;
Expand Down Expand Up @@ -43,7 +44,7 @@ const ListItem = styled.li<{ $isActive?: boolean }>`
gap: 10px;
transition: 0.3s;
background-color: ${({ theme, $isActive }) =>
$isActive ? theme.dm__primaryColor : "transparent"};
$isActive ? chroma(theme.primaryColor).darken().hex() : "transparent"};
cursor: pointer;
&:hover {
transform: scale(1.05);
Expand All @@ -57,20 +58,20 @@ const StyledText = styled(Text)<{ $isActive?: boolean }>`
`;

const StyledIconText = styled(IconText)<{ $isActive?: boolean }>`
& > span {
* {
font-weight: ${({ $isActive }) => ($isActive ? "bold" : "normal")};
${basicColorStyle}
& > svg {
fill: ${({ theme, $isActive }) =>
$isActive
? theme.white
: getStylesBasedOnTheme(
theme.mode,
theme.dm__outlineButtonColor,
theme.outlineButtonColor,
theme.primaryColor
)};
}
}
svg {
fill: ${({ theme, $isActive }) =>
$isActive
? theme.white
: getStylesBasedOnTheme(
theme.mode,
theme.dm__outlineButtonColor,
theme.outlineButtonColor,
theme.primaryColor
)} !important;
}
`;
const List: FC<ListProps> = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useId, useState } from "react";
import styled, { createGlobalStyle, withTheme } from "styled-components";
import ReactMarkdown from "react-markdown";
import { ReactMarkdownOptions } from "react-markdown/lib/react-markdown";
Expand Down Expand Up @@ -236,12 +236,16 @@ export const MarkdownRenderer: React.FC<MarkdownRendererProps> = (props) => {
export const MarkdownCheckList: React.FC<
React.InputHTMLAttributes<HTMLInputElement>
> = ({ checked, disabled, type }) => {
const ID = useId();
return (
<input
id={ID}
className="text-checkbox"
type={type}
disabled={disabled}
checked={checked}
aria-labelledby={ID}
placeholder="checkbox"
/>
);
};
Expand Down
8 changes: 4 additions & 4 deletions src/components/players/AudioVideoPlayer/AudioVideoPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import img2 from "./VideoPlayerPoster.png";
>
Nowość
</Badge>
<div className="video-player-breadcrumbs">
{/* <div className="video-player-breadcrumbs">
<Link href="http://onet.pl" target="_blank">
Onet
</Link>
<Link href="http://onet.pl" target="_blank">
Onet
</Link>
</div>
</div> */}
<Title level={3}>Video Example</Title>
<div className="video-player-footer">
<Text size={"12"} noMargin>
Expand Down Expand Up @@ -63,14 +63,14 @@ import img2 from "./VideoPlayerPoster.png";
>
Nowość
</Badge>
<div className="video-player-breadcrumbs">
{/* <div className="video-player-breadcrumbs">
<Link href="http://onet.pl" target="_blank">
Onet
</Link>
<Link href="http://onet.pl" target="_blank">
Onet
</Link>
</div>
</div> */}
<Title level={3}>Audio Example</Title>
<div className="video-player-footer">
<Text size={"12"} noMargin>
Expand Down
5 changes: 4 additions & 1 deletion src/components/players/AudioVideoPlayer/AudioVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,10 @@ export const AudioVideoPlayer: React.FC<AudioVideoPlayerProps> = (props) => {
playing: !prevState.playing,
}))
}
role={audioVideoState.playing ? "button" : undefined}
title="play/pause"
aria-labelledby="labeldiv"
tabIndex={0}
role="button"
onKeyDown={() => {
return true;
}}
Expand Down
Loading