Skip to content

Commit 7a9b2bd

Browse files
authored
fix: fluent v9 upgrade accessibility issues from Accessibility Insights (#3593)
* add aria-labels * add aria-labels * replace with avatar * add aria-labels * add tooltip * add aria-labels * add tooltips * add aria-hidden to items * add aria-label * add tooltips * add spacing for better keyboard outline
1 parent 669965a commit 7a9b2bd

File tree

13 files changed

+75
-35
lines changed

13 files changed

+75
-35
lines changed

src/app/views/authentication/auth-util-components/ProfileButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import { ProfileV9 } from '../profile/Profile';
66
export const PersonaSignIn = (props: Partial<PersonaProps>) => {
77
return (
88
<Persona
9+
aria-hidden={true}
910
presence={{ status: 'offline' }}
1011
{...props}
1112
/>
1213
);
1314
};
1415

1516
const SignInButton = ({signIn}: {signIn: ()=> void})=>{
16-
const styles = useHeaderStyles()
17+
const styles = useHeaderStyles();
1718
return (
1819
<Tooltip
1920
content={translateMessage('sign in')}

src/app/views/common/popups/DrawerWrapper.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
DrawerHeaderTitle,
88
Button,
99
Spinner,
10-
makeStyles
10+
makeStyles,
11+
Tooltip
1112
} from '@fluentui/react-components';
1213
import { ArrowLeft24Regular, Dismiss24Regular } from '@fluentui/react-icons';
1314

@@ -66,22 +67,28 @@ export function DrawerWrapper(props: WrapperProps) {
6667
>
6768
<DrawerHeader>
6869
<DrawerHeaderTitle action={
69-
<Button
70-
icon={<Dismiss24Regular />}
71-
appearance='subtle'
72-
onClick={() => dismissPopup()}
73-
aria-label={translateMessage('Close')}
74-
/>
75-
76-
}>
77-
{showBackButton && (
70+
<Tooltip
71+
content={translateMessage('Close')} relationship='label'>
7872
<Button
79-
icon={<ArrowLeft24Regular />}
73+
icon={<Dismiss24Regular />}
8074
appearance='subtle'
8175
onClick={() => dismissPopup()}
82-
aria-label={translateMessage('Back')}
83-
className={drawerStyles.button}
76+
aria-label={translateMessage('Close')}
8477
/>
78+
</Tooltip>
79+
}>
80+
{showBackButton && (
81+
<Tooltip
82+
content={translateMessage('Back')}
83+
relationship='label'>
84+
<Button
85+
icon={<ArrowLeft24Regular />}
86+
appearance='subtle'
87+
onClick={() => dismissPopup()}
88+
aria-label={translateMessage('Back')}
89+
className={drawerStyles.button}
90+
/>
91+
</Tooltip>
8592
)}
8693
{title || ''}
8794
</DrawerHeaderTitle>

src/app/views/layout/LayoutResizeHandler.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ export const LayoutResizeHandler = React.forwardRef<HTMLDivElement, HandleProps>
6464
ref={ref}
6565
onClick={handleClick}
6666
onMouseDown={onMouseDown}
67-
tabIndex={0}
67+
tabIndex={-1}
6868
className={hoverStyles}
6969
style={{
7070
position: 'absolute',
7171
borderRadius: '2px',
7272
...positioningProps
7373
}}
74+
aria-hidden={true}
7475
/>
7576
);
7677
}

src/app/views/main-header/FeedbackButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const FeedbackButton = ()=>{
3131
<>
3232
<Tooltip content={translateMessage('Feedback')} relationship="description">
3333
<Button
34+
aria-label={translateMessage('Feedback')}
3435
onClick={activateSurvey}
3536
className={styles.iconButton} appearance="subtle" icon={<PersonFeedback20Regular />} />
3637
</Tooltip>

src/app/views/main-header/Help.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const Help = ()=>{
3535
<Tooltip content={translateMessage('Help')} relationship="description">
3636
<MenuTrigger disableButtonEnhancement>
3737
<Button
38+
aria-label={translateMessage('Help')}
3839
onClick={trackHelpButtonClickEvent}
3940
className={styles.iconButton} appearance="subtle" icon={<ChatHelp20Regular />} />
4041
</MenuTrigger>

src/app/views/main-header/settings/Settings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const Settings = ()=>{
4242
<Tooltip content={translateMessage('Settings')} relationship="description">
4343
<MenuTrigger disableButtonEnhancement>
4444
<Button
45+
aria-label={translateMessage('Settings')}
4546
onClick={trackSettingsButtonClickEvent}
4647
className={styles.iconButton} appearance="subtle" icon={<Settings20Regular />} />
4748
</MenuTrigger>

src/app/views/query-response/QueryResponse.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import {
66
DialogSurface,
77
DialogTrigger,
88
makeStyles,
9-
tokens
9+
tokens,
10+
Tooltip
1011
} from '@fluentui/react-components';
1112
import { DismissRegular, ExpandUpLeftRegular } from '@fluentui/react-icons';
1213
import { useState } from 'react';
1314
import { GetPivotItems } from './pivot-items/pivot-item';
15+
import { translateMessage } from '../../utils/translate-messages';
1416

1517
const useStyles = makeStyles({
1618
container: {
@@ -45,13 +47,15 @@ const PivotItemsDialog = () => {
4547

4648
return (
4749
<div>
48-
<Button
49-
appearance='transparent'
50-
icon={<ExpandUpLeftRegular />}
51-
aria-label='Expand'
52-
className={styles.dialogBtn}
53-
onClick={() => setOpen(true)}
54-
/>
50+
<Tooltip content={translateMessage('Expand')} relationship='label'>
51+
<Button
52+
appearance='transparent'
53+
icon={<ExpandUpLeftRegular />}
54+
aria-label={translateMessage('Expand')}
55+
className={styles.dialogBtn}
56+
onClick={() => setOpen(true)}
57+
/>
58+
</Tooltip>
5559
<Dialog open={open} onOpenChange={(_event, data) => setOpen(data.open)}>
5660
<DialogSurface className={styles.dialog}>
5761
<DialogBody>
@@ -60,13 +64,15 @@ const PivotItemsDialog = () => {
6064
</DialogContent>
6165
</DialogBody>
6266
<DialogTrigger disableButtonEnhancement>
63-
<Button
64-
appearance='transparent'
65-
icon={<DismissRegular />}
66-
aria-label='Collapse'
67-
className={styles.dismissBtn}
68-
onClick={() => setOpen(false)}
69-
/>
67+
<Tooltip relationship='label' content={translateMessage('Close')}>
68+
<Button
69+
appearance='transparent'
70+
icon={<DismissRegular />}
71+
aria-label={translateMessage('Close')}
72+
className={styles.dismissBtn}
73+
onClick={() => setOpen(false)}
74+
/>
75+
</Tooltip>
7076
</DialogTrigger>
7177
</DialogSurface>
7278
</Dialog>

src/app/views/query-response/pivot-items/pivot-item.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ const useStyles = makeStyles({
5050
height: '100%',
5151
overflow: 'hidden'
5252
},
53+
tabList:{
54+
padding: '5px 5px'
55+
},
5356
tabContent: {
5457
flex: 1,
5558
display: 'flex',
@@ -137,7 +140,7 @@ export const GetPivotItems = () => {
137140
</TabList>
138141
</Overflow>
139142
) : (
140-
<TabList selectedValue={selectedValue} onTabSelect={onTabSelect} size='small'>
143+
<TabList selectedValue={selectedValue} onTabSelect={onTabSelect} size='small' className={styles.tabList}>
141144
{tabs.map((tab) => (
142145
<Tab key={tab.id} value={tab.id} icon={tab.icon}>
143146
{tab.name}

src/app/views/query-runner/request/RequestV9.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ const useStyles = makeStyles({
4747
flexShrink: 0,
4848
overflowX: 'hidden'
4949
},
50+
tabList: {
51+
padding: '5px 5px'
52+
},
5053
tabContent: {
5154
flex: 1,
5255
display: 'flex',
@@ -142,7 +145,10 @@ const Request = (props: IRequestProps) => {
142145
</TabList>
143146
</Overflow>
144147
) : (
145-
<TabList selectedValue={selectedTab} onTabSelect={(_, data) => handleTabSelect(data.value)} size='small'>
148+
<TabList selectedValue={selectedTab}
149+
onTabSelect={(_, data) => handleTabSelect(data.value)}
150+
size='small' className={styles.tabList}
151+
>
146152
{tabs.map((tab) => (
147153
<Tab key={tab.id} value={tab.id} icon={tab.icon}>
148154
{tab.name}

src/app/views/sidebar/Sidebar.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
2-
Button, ButtonProps, makeStyles, SelectTabData, SelectTabEvent, Tab, TabList, tokens
2+
Button, ButtonProps, makeStyles, SelectTabData, SelectTabEvent, Tab, TabList, tokens,
3+
Tooltip
34
} from '@fluentui/react-components';
45
import {
56
GroupList20Regular, History20Regular, PanelLeftContract20Regular, PanelLeftExpand20Regular, Rocket20Regular
@@ -34,7 +35,13 @@ const SidebarToggle = (props: IShowSidebar & ButtonProps)=>{
3435
const {show, handleShow} = props;
3536
const PanelIcon = ()=> show ? <PanelLeftContract20Regular/>: <PanelLeftExpand20Regular/>
3637

37-
return <Button appearance='subtle' icon={PanelIcon()} onClick={handleShow} {...props}></Button>
38+
return (
39+
<Tooltip content={show? translateMessage('Minimize sidebar'): translateMessage('Maximize sidebar')}
40+
relationship='label'>
41+
<Button appearance='subtle' icon={PanelIcon()} onClick={handleShow} {...props}>
42+
</Button>
43+
</Tooltip>
44+
)
3845
}
3946

4047
interface SidebarProps {

0 commit comments

Comments
 (0)