Skip to content

Commit

Permalink
fix(accessibility): remove b and i tags
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineBda committed Oct 2, 2023
1 parent ac61c63 commit d1ec7a1
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
InsertTitle,
Paragraph,
Section,
Text,
theme,
Title,
Toast,
Expand Down Expand Up @@ -127,7 +128,8 @@ const Contribution = ({ answers, content }) => {
>
{isConventionalAnswer ? (
<>
Que dit la convention <i>{conventionAnswer.shortName}</i>
Que dit la convention{" "}
<Text italic>{conventionAnswer.shortName}</Text>
&nbsp;?
</>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
icons,
Paragraph,
Section,
Text,
theme,
Title,
Toast,
Expand Down Expand Up @@ -61,7 +62,8 @@ const ContributionCC = ({ answers, content, slug }) => {
<Title shift={spacings.xmedium} variant="primary">
{isConventionalAnswer ? (
<>
Que dit la convention <i>{conventionAnswer.shortName}</i>
Que dit la convention{" "}
<Text italic>{conventionAnswer.shortName}</Text>
&nbsp;?
</>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import IntroAnnotation from "../../steps/component/IntroAnnotation";
import React from "react";
import { Step } from "../../../Simulator";
import { PreavisRetraiteFormState } from "../../form";

export const steps: Step<StepName>[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,9 @@ const DecryptedResult: React.FC<Props> = ({
</Paragraph>
{description && <Paragraph>{description}</Paragraph>}
{rootData.handicap && (
<Paragraph>
<i>
Ce résultat tient compte de la majoration pour les travailleurs
handicapés.
</i>
<Paragraph italic>
Ce résultat tient compte de la majoration pour les travailleurs
handicapés.
</Paragraph>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from "react";
import { Text } from "@socialgouv/cdtn-ui";

const IntroAnnotation = (): JSX.Element => {
return (
<i>
<Text italic>
Attention&nbsp;: Le résultat affiché correspond à la durée légale ou
conventionnelle, en fonction des informations renseignées.
</i>
</Text>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Absence, SalaryPeriods } from "@socialgouv/modeles-social";
import { SectionTitle } from "../../../../common/stepStyles";
import { AgreementInformation } from "../../../common";
import { Table, theme, Paragraph } from "@socialgouv/cdtn-ui";
import { Paragraph, Table, theme } from "@socialgouv/cdtn-ui";
import styled from "styled-components";
import { publicodesUnitTranslator } from "../../../../publicodes";
import AbsenceTable from "./AbsenceTable";
Expand Down Expand Up @@ -56,15 +56,12 @@ export default function FilledElements(props: Props) {
!props.isAgreementBetter &&
"*"}
{props.isLicenciementInaptitude && !props.isAgreementBetter && (
<>
<br />
<i>
* Le salarié ayant été licencié pour inaptitude suite à un
accident du travail ou une maladie professionnelle reconnue,
le montant de l&apos;indemnité de licenciement légale est
doublé
</i>
</>
<Paragraph italic noMargin>
* Le salarié ayant été licencié pour inaptitude suite à un
accident du travail ou une maladie professionnelle reconnue,
le montant de l&apos;indemnité de licenciement légale est
doublé
</Paragraph>
)}
<li>
Arrêt de travail au moment du licenciement&nbsp;:&nbsp;
Expand Down Expand Up @@ -122,15 +119,13 @@ export default function FilledElements(props: Props) {
{!props.disableParentalNotice && <sup>*</sup>}&nbsp;:&nbsp;
{props.absencesPeriods.length > 0 ? "Oui" : "Non"}
{!props.disableParentalNotice && (
<Paragraph fontSize="small" noMargin>
<i>
<sup>*</sup> Depuis le 11 mars 2023 les périodes d’absence
pour congé paternité ne sont plus retirées de l’ancienneté
du salarié. Si le salarié a pris un congé paternité avant
cette date, il peut être décompté de son ancienneté et de ce
fait, donner lieu à un montant d’indemnité moins favorable
que celui de notre simulateur.
</i>
<Paragraph fontSize="small" noMargin italic>
<sup>*</sup> Depuis le 11 mars 2023 les périodes d’absence
pour congé paternité ne sont plus retirées de l’ancienneté du
salarié. Si le salarié a pris un congé paternité avant cette
date, il peut être décompté de son ancienneté et de ce fait,
donner lieu à un montant d’indemnité moins favorable que celui
de notre simulateur.
</Paragraph>
)}
</li>
Expand Down Expand Up @@ -228,6 +223,7 @@ export const StyledFilledElementTable = styled(Table)`
th {
vertical-align: top;
}
tbody {
th {
font-weight: normal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Link from "next/link";
import styled from "styled-components";
import { theme } from "@socialgouv/cdtn-ui";
import { Paragraph } from "@socialgouv/cdtn-ui/lib";

type Props = {
message?: string;
Expand All @@ -24,12 +23,9 @@ export default function ForMoreInfo({ message = defaultMessage }: Props) {
</Link>
.
</p>
<StyledI>{message}</StyledI>
<Paragraph italic fontSize="small">
{message}
</Paragraph>
</>
);
}
const { fonts } = theme;

const StyledI = styled.i`
font-size: ${fonts.sizes.small};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const QuestionnaireItem = ({
const [status, setStatus] = useState<Status>();
return (
<div className={className} data-testId={dataTestId}>
{title && <b>{title}</b>}
{title && <strong>{title}</strong>}
<ButtonContainer>
<StyledButton
variant={status === Status.BAD ? "light" : "naked"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const QuestionnaireText = ({
const maxCharacters = 200;
return (
<StyledContainer className={className}>
{title && <b>{title}</b>}
{title && <strong>{title}</strong>}
<StyledTextarea
placeholder={placeholder}
maxLength={maxCharacters}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const PubliSituation = ({
</ul>
{annotations &&
annotations.map((annotation, index) => (
<Paragraph key={index}>
<i>*&nbsp;{annotation}</i>
<Paragraph italic key={index}>
*&nbsp;{annotation}
</Paragraph>
))}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Fieldset, Legend, Text } from "@socialgouv/cdtn-ui";
import { InfoBulle } from "../../../outils/common/InfoBulle";
import { trackClickHelp } from "../../tracking";
import React, { useContext } from "react";
import { Paragraph } from "@socialgouv/cdtn-ui/lib";

type QuestionProps = {
widgetMode: boolean;
Expand Down Expand Up @@ -41,16 +42,11 @@ export const Question = ({ widgetMode }: QuestionProps) => {
index={index}
></Response>
))}
<Description>{currentQuestion?.description}</Description>
<Paragraph italic>{currentQuestion?.description}</Paragraph>
</Fieldset>
);
};

const StyledInfoBulle = styled(InfoBulle)`
padding: 0;
`;

const Description = styled.i`
display: block;
margin-top: 7px;
`;
21 changes: 16 additions & 5 deletions packages/react-ui/src/Text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const sharedStyle = css`
? fonts.sizes.headings[props.$fontSize.replace("h", "")]
: fonts.sizes[props.$fontSize]};
font-weight: ${(props) => props.$fontWeight};
${(props) => (props.$italic ? "font-style: italic" : "")};
`;
}}
`;
Expand All @@ -36,13 +37,13 @@ const spanPropTypes = {
"hlarge",
]),
fontWeight: PropTypes.oneOf(["300", "400", "500", "600", "700"]),
noMargin: PropTypes.bool,
italic: PropTypes.bool,
role: PropTypes.string,
variant: PropTypes.oneOf(["primary", "secondary", "error", "placeholder"]),
};

const defaultSpanPropTypes = {
fontSize: "default",
fontSize: "inherit",
fontWeight: "400",
};

Expand All @@ -61,12 +62,20 @@ Text.defaultProps = defaultSpanPropTypes;
Paragraph.propTypes = paragraphPropTypes;
Paragraph.defaultProps = defaultParagraphPropTypes;

export function Text({ children, fontSize, fontWeight, variant, ...props }) {
export function Text({
children,
fontSize,
italic,
fontWeight,
variant,
...props
}) {
return (
<Span
{...props}
$fontWeight={fontWeight}
$fontSize={fontSize}
$fontWeight={fontWeight}
$italic={italic}
$variant={variant}
>
{children}
Expand All @@ -78,15 +87,17 @@ export function Paragraph({
children,
fontSize,
fontWeight,
italic,
noMargin,
variant,
...props
}) {
return (
<P
{...props}
$fontWeight={fontWeight}
$fontSize={fontSize}
$italic={italic}
$fontWeight={fontWeight}
$noMargin={noMargin}
$variant={variant}
>
Expand Down

0 comments on commit d1ec7a1

Please sign in to comment.