From 5fc255badc6bce977f6573dbc330961bb79d7b3a Mon Sep 17 00:00:00 2001 From: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:53:54 +0100 Subject: [PATCH] Merge pull request #17568 from overleaf/rd-b5-button-fix [web] Fix the Button component accessibility label GitOrigin-RevId: 1d157fca370c5e0425890468d7cad169d0261c23 --- .../ui/components/bootstrap-5/icon-button.tsx | 11 +++-------- .../ui/components/bootstrap-5/icon-text-button.tsx | 5 +---- .../ui/components/bootstrap-5/split-button.tsx | 7 ++++++- .../features/ui/components/types/icon-button-props.ts | 1 + .../ui/components/types/split-button-props.ts | 1 + .../web/frontend/stories/ui/icon-button.stories.tsx | 5 ++++- .../web/frontend/stories/ui/split-button.stories.tsx | 5 ++++- .../bootstrap-5/scss/components/button.scss | 4 ++-- 8 files changed, 22 insertions(+), 17 deletions(-) diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/icon-button.tsx b/services/web/frontend/js/features/ui/components/bootstrap-5/icon-button.tsx index e78194374e..7923dcdb31 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/icon-button.tsx +++ b/services/web/frontend/js/features/ui/components/bootstrap-5/icon-button.tsx @@ -1,22 +1,17 @@ -import { useTranslation } from 'react-i18next' import MaterialIcon from '@/shared/components/material-icon' import Button from './button' import type { IconButtonProps } from '@/features/ui/components/types/icon-button-props' import classNames from 'classnames' export default function IconButton({ + accessibilityLabel, icon, isLoading = false, size = 'default', ...props }: IconButtonProps) { - const { t } = useTranslation() - const iconButtonClassName = `icon-button-${size}` - const iconSizeClassName = - size === 'large' - ? 'leading-trailing-icon-large' - : 'leading-trailing-icon-small' + const iconSizeClassName = size === 'large' ? 'icon-large' : 'icon-small' const materialIconClassName = classNames(iconSizeClassName, { 'button-content-hidden': isLoading, }) @@ -24,7 +19,7 @@ export default function IconButton({ return (