aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmbroise C <ambroise.christea@sonarsource.com>2024-11-22 12:19:59 +0100
committersonartech <sonartech@sonarsource.com>2024-11-22 20:03:09 +0000
commit664e392ebfedaf163c6b6cf9a2f60b37b3005955 (patch)
tree44447ebb5aad4bb30a2ed21d6b9742c1e80f9958
parent7a9d3ce2bccf2779a492eeaec43a1a0b6f938070 (diff)
downloadsonarqube-664e392ebfedaf163c6b6cf9a2f60b37b3005955.tar.gz
sonarqube-664e392ebfedaf163c6b6cf9a2f60b37b3005955.zip
SONAR-22322 Fix a11y issues on Webhooks page
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/controls/ModalValidationField.tsx22
2 files changed, 20 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx
index d06273188d9..a4586a3fff9 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx
@@ -18,9 +18,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { Heading, Link } from '@sonarsource/echoes-react';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { Link, Title } from '~design-system';
import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
@@ -35,7 +35,9 @@ export default function PageHeader({ children }: Readonly<Props>) {
return (
<header className="sw-mb-2 sw-flex sw-items-center sw-justify-between">
<div>
- <Title>{translate('webhooks.page')}</Title>
+ <Heading as="h1" className="sw-mb-4">
+ {translate('webhooks.page')}
+ </Heading>
<p>{translate('webhooks.description0')}</p>
<p>
<FormattedMessage
diff --git a/server/sonar-web/src/main/js/components/controls/ModalValidationField.tsx b/server/sonar-web/src/main/js/components/controls/ModalValidationField.tsx
index 753dc4263bb..a9c2bdf8861 100644
--- a/server/sonar-web/src/main/js/components/controls/ModalValidationField.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ModalValidationField.tsx
@@ -19,8 +19,10 @@
*/
import styled from '@emotion/styled';
+import { IconCheckCircle, IconError } from '@sonarsource/echoes-react';
import * as React from 'react';
-import { FlagErrorIcon, FlagSuccessIcon, FormField, Note, themeColor } from '~design-system';
+import { FormattedMessage } from 'react-intl';
+import { FormField, Note, themeColor } from '~design-system';
import { translate } from '../../helpers/l10n';
interface Props {
@@ -34,7 +36,7 @@ interface Props {
touched: boolean | undefined;
}
-export default function ModalValidationField(props: Props) {
+export default function ModalValidationField(props: Readonly<Props>) {
const { description, dirty, error, label, id, required } = props;
const isValid = dirty && props.touched && error === undefined;
@@ -48,12 +50,20 @@ export default function ModalValidationField(props: Props) {
>
<div className="sw-flex sw-items-center sw-justify-between">
{props.children({ isInvalid: showError, isValid })}
- {showError && <FlagErrorIcon className="sw-ml-2" />}
- {isValid && <FlagSuccessIcon className="sw-ml-2" />}
+ {showError && <IconError color="echoes-color-icon-danger" className="sw-ml-2" />}
+ {isValid && <IconCheckCircle color="echoes-color-icon-success" className="sw-ml-2" />}
</div>
- {showError && <StyledNote className="sw-mt-2">{error}</StyledNote>}
- {description && <Note className="sw-mt-2">{description}</Note>}
+ <div aria-live="assertive">
+ {isValid && (
+ <span className="sw-mt-2 sw-sr-only">
+ <FormattedMessage id="valid_input" />
+ </span>
+ )}
+ {showError && <StyledNote className="sw-mt-2">{error}</StyledNote>}
+ </div>
+
+ {description !== undefined && <Note className="sw-mt-2">{description}</Note>}
</FormField>
);
}