Skip to content

Commit c065bdf

Browse files
authored
Merge pull request #57 from microsoft/a11y-insights
Fix a11y insights
2 parents 302b0a1 + 64b232e commit c065bdf

17 files changed

+153
-133
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Flask",
66
"type": "debugpy",
77
"request": "launch",
8-
"program": "${workspaceFolder}/app.py",
8+
"program": "${workspaceFolder}/py-src/data_formulator/app.py",
99
"args": ["run", "--no-debugger", "--no-reload"],
1010
"env": {
1111
"FLASK_APP": "app.py",

src/app/App.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const ImportStateButton: React.FC<{}> = ({ }) => {
106106

107107

108108
return <Tooltip title="load a saved session">
109-
<Button variant="text" color="primary" component="label"
109+
<Button variant="text" color="primary"
110110
//endIcon={<InputIcon />}
111111
>
112112
<Input inputProps={{ accept: '.dfstate', multiple: false }} id="upload-data-file"
@@ -224,6 +224,9 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
224224
custom: {
225225
main: "rgb(255, 160, 122)", //lightsalmon
226226
},
227+
warning: {
228+
main: '#bf5600', // New accessible color, original (#ed6c02) has insufficient color contrast of 3.11
229+
},
227230
},
228231
});
229232

@@ -245,12 +248,12 @@ export const AppFC: FC<AppFCProps> = function AppFC(appProps) {
245248
aria-label="View Mode"
246249
sx={{ marginRight: "8px", height: 32, padding: "4px 0px", marginTop: "2px", "& .MuiToggleButton-root": { padding: "0px 6px" } }}
247250
>
248-
<ToggleButton value="carousel">
251+
<ToggleButton value="carousel" aria-label="view list">
249252
<Tooltip title="view list">
250253
<ViewSidebarIcon fontSize="small" sx={{ transform: "scaleX(-1)" }} />
251254
</Tooltip>
252255
</ToggleButton>
253-
<ToggleButton value="gallery">
256+
<ToggleButton value="gallery" aria-label="view grid">
254257
<Tooltip title="view grid">
255258
<GridViewIcon fontSize="small" />
256259
</Tooltip>

src/scss/App.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ h2.view-title {
2626
margin: 0;
2727
line-height: 1.75;
2828
display: inline-block;
29-
color: #777;
29+
color: #717171;
3030
//font-weight: 600;
3131
//text-transform: uppercase;
3232
font-size: 14px;

src/scss/DataView.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
margin-top: 4px;
3333
display: inline-block;
3434
font-size: 18px;
35-
color: #777;
35+
color: #717171;
3636
}
3737

3838
.table-container-small {

src/scss/EncodingShelf.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
flex-direction: column;
4545
justify-content: center
4646
}
47+
48+
.table-list-item {
49+
display: flex;
50+
}
4751
}
4852

4953
.auto-sort-option-label {

src/views/ConceptCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const ConceptCard: FC<ConceptCardProps> = function ConceptCard({ field })
130130

131131

132132

133-
let opacity = isDragging ? 0.3 :(notInFocusedTable ? 0.4 : 1);
133+
let opacity = isDragging ? 0.3 :(notInFocusedTable ? 0.65 : 1);
134134
let fontStyle = "inherit";
135135
let border = "hidden";
136136

@@ -278,7 +278,7 @@ export const ConceptCard: FC<ConceptCardProps> = function ConceptCard({ field })
278278
<Typography className="draggable-card-title" sx={{ fontSize: 13, height: 28, width: "100%" }} component={'span'} gutterBottom>
279279
{typeIconMenu}
280280
{fieldNameEntry}
281-
{field.semanticType ? <Typography sx={{fontSize: "xx-small", marginLeft: "6px", color: 'darkgray', fontStyle: 'italic'}}>-- {field.semanticType}</Typography> : ""}
281+
{field.semanticType ? <Typography sx={{fontSize: "xx-small", marginLeft: "6px", fontStyle: 'italic'}}>-- {field.semanticType}</Typography> : ""}
282282
{/* {field.source == "custom" ? exampleToComponent(field.domain.values, 3) : ""} */}
283283
</Typography>
284284
<Box className='draggable-card-action-button' sx={{ position: "absolute", right: 1, background: 'rgba(255, 255, 255, 0.95)' }}>{cardHeaderOptions}</Box>

src/views/ConceptShelf.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const ConceptShelf: FC<ConceptShelfProps> = function ConceptShelf() {
129129
<Box className="data-fields-list">
130130
<Box sx={{display: "block", width: "100%"}}>
131131
<Divider orientation="horizontal" textAlign="left">
132-
<Typography component="h2" sx={{fontSize: "10px"}} color="darkgray">
132+
<Typography component="h2" sx={{fontSize: "10px"}} color="text.secondary">
133133
field operators
134134
</Typography>
135135
</Divider>
@@ -143,7 +143,7 @@ export const ConceptShelf: FC<ConceptShelfProps> = function ConceptShelf() {
143143
</Box>
144144
{groupNames.map(gp => [
145145
<Box sx={{display: "block", width: "100%"}}>
146-
<Divider orientation="horizontal" textAlign="left"><Typography component="h2" sx={{fontSize: "10px"}} color="darkgray">
146+
<Divider orientation="horizontal" textAlign="left"><Typography component="h2" sx={{fontSize: "10px"}} color="text.secondary">
147147
{gp}
148148
</Typography></Divider>
149149
</Box>,

src/views/DataThread.tsx

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,18 @@ import React, { FC, useEffect, useRef, useState } from 'react';
55

66
import {
77
Box,
8-
Button,
98
Divider,
109
Typography,
1110
LinearProgress,
12-
ListItem,
1311
Stack,
1412
ListItemIcon,
15-
List,
1613
Card,
1714
IconButton,
1815
Tooltip,
1916
ButtonGroup,
2017
useTheme,
21-
Drawer,
22-
ListItemButton,
23-
ListItemText,
24-
Collapse,
25-
Grow,
26-
alpha,
2718
} from '@mui/material';
2819

29-
import embed from 'vega-embed';
30-
import AnimateOnChange from 'react-animate-on-change'
3120
import { VegaLite } from 'react-vega'
3221

3322

@@ -128,11 +117,11 @@ let SingleThreadView: FC<{
128117
let currentActiveFields = new Set(extractActiveFields(trigger))
129118
let fieldsIdentical = _.isEqual(previousActiveFields, currentActiveFields)
130119

131-
let triggerCard = <ListItem key={'thread-card-trigger-box'} sx={{padding: '0'}}>
120+
let triggerCard = <div key={'thread-card-trigger-box'}>
132121
<Box sx={{flex: 1}} /*sx={{ width: 'calc(100% - 8px)', marginLeft: 1, borderLeft: '1px dashed darkgray' }}*/ >
133122
<TriggerCard className={selectedClassName} trigger={trigger} hideFields={fieldsIdentical} />
134123
</Box>
135-
</ListItem>;
124+
</div>;
136125

137126
return <Box sx={{display: 'flex', flexDirection: 'column'}} key={`trigger-card-${trigger.chartRef}`}>
138127
{triggerCard}
@@ -165,7 +154,7 @@ let SingleThreadView: FC<{
165154
// only charts without dependency can be deleted
166155
let tableDeleteEnabled = table?.derive && !tables.some(t => t.derive?.trigger.tableId == tableId);
167156

168-
let colloapsedTableBox = <ListItem sx={{padding: 0}}>
157+
let colloapsedTableBox = <div style={{padding: 0}}>
169158
<Box sx={{textTransform: 'none', padding: 0, minWidth: 0, color: 'gray'}} >
170159
<Stack direction="row" sx={{fontSize: '12px', fontWeight: tableId == focusedTableId ? 'bold' : 'normal'}} alignItems="center" gap={"2px"}>
171160
<TableRowsIcon fontSize="inherit" sx={{fontWeight: 'inherit'}}/>
@@ -174,9 +163,9 @@ let SingleThreadView: FC<{
174163
</Typography>
175164
</Stack>
176165
</Box>
177-
</ListItem>;
166+
</div>;
178167

179-
let regularTableBox = <ListItem ref={relevantCharts.some(c => c.chartId == focusedChartId) ? scrollRef : null} sx={{padding: '0px'}}>
168+
let regularTableBox = <div ref={relevantCharts.some(c => c.chartId == focusedChartId) ? scrollRef : null} style={{padding: '0px'}}>
180169
<Card className={`data-thread-card ${selectedClassName}`} variant="outlined"
181170
sx={{ width: '100%', background: 'aliceblue' }}
182171
onClick={() => {
@@ -222,14 +211,14 @@ let SingleThreadView: FC<{
222211
</ButtonGroup>
223212
</Box>
224213
</Card>
225-
</ListItem>
214+
</div>
226215

227216
let chartElementProps = collapsed ? {display: 'flex', flexWrap: 'wrap'} : {}
228217

229218
return [
230219
regularTableBox,
231220
<Box sx={{display: 'flex', flexDirection: 'row'}}>
232-
<Button sx={{minWidth: '1px', padding: '0px', width: '17px', flex: 'none', display: 'flex'
221+
<div style={{minWidth: '1px', padding: '0px', width: '17px', flex: 'none', display: 'flex'
233222
//borderLeft: '1px dashed darkgray',
234223
}}>
235224
<Box sx={{padding:0, width: '1px', margin:'auto', height: '100%',
@@ -238,7 +227,7 @@ let SingleThreadView: FC<{
238227
backgroundImage: 'linear-gradient(180deg, darkgray, darkgray 75%, transparent 75%, transparent 100%)',
239228
backgroundSize: '1px 6px, 3px 100%'
240229
}}></Box>
241-
</Button>
230+
</div>
242231
<Box sx={{flex: 1, padding: '8px 0px', minHeight: '8px', ...chartElementProps}}>
243232
{releventChartElements}
244233
</Box>
@@ -281,14 +270,14 @@ let SingleThreadView: FC<{
281270
"& .MuiDivider-wrapper": { display: 'flex', flexDirection: 'row' },
282271
"&::before, &::after": { borderColor: 'darkgray', borderWidth: '2px', width: 50 },
283272
}}>
284-
<Typography sx={{fontSize: "10px", fontWeight: 'bold', color:'rgba(100, 100, 100, 0.8)', textTransform: 'none'}}>
273+
<Typography sx={{fontSize: "10px", fontWeight: 'bold', color:'text.secondary', textTransform: 'none'}}>
285274
{`thread - ${threadIdx + 1}`}
286275
</Typography>
287276
</Divider>
288277
</Box>
289-
<List sx={{padding: '2px 4px 2px 4px', marginTop: 0, marginBottom: '8px', direction: 'ltr'}}>
278+
<div style={{padding: '2px 4px 2px 4px', marginTop: 0, marginBottom: '8px', direction: 'ltr'}}>
290279
{content}
291-
</List>
280+
</div>
292281
</Box>
293282
}
294283

@@ -480,9 +469,11 @@ export const DataThread: FC<{}> = function ({ }) {
480469
<Typography className="view-title" component="h2" sx={{marginTop: "6px"}}>
481470
Data Threads
482471
</Typography>
483-
<IconButton size={'small'} color="primary" disabled={leafTables.length <= 1} onClick={() => { setThreadDrawerOpen(!threadDrawerOpen); }}>
484-
{drawerOpen ? <ChevronLeftIcon /> : <ChevronRightIcon />}
485-
</IconButton>
472+
<Tooltip title={drawerOpen ? "collapse" : "expand"}>
473+
<IconButton size={'small'} color="primary" disabled={leafTables.length <= 1} onClick={() => { setThreadDrawerOpen(!threadDrawerOpen); }}>
474+
{drawerOpen ? <ChevronLeftIcon /> : <ChevronRightIcon />}
475+
</IconButton>
476+
</Tooltip>
486477
</Box>
487478
<Box sx={{transition: 'width 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms', overflow: 'auto',
488479
direction: 'rtl', display: 'flex', flex: 1}}

src/views/DataView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const FreeDataViewFC: FC<FreeDataViewProps> = function DataView({ $table
8484
if (colDefs) {
8585
colDefs = [{
8686
id: "#rowId", label: "#", minWidth: 10, align: undefined, width: 40,
87-
format: (value: any) => <Typography fontSize="inherit" color="rgba(0,0,0,0.5)">{value}</Typography>,
87+
format: (value: any) => <Typography fontSize="inherit" color="rgba(0,0,0,0.65)">{value}</Typography>,
8888
dataType: Type.Number,
8989
source: "original",
9090
}, ...colDefs]
@@ -110,7 +110,7 @@ export const FreeDataViewFC: FC<FreeDataViewProps> = function DataView({ $table
110110

111111
let genTableLink = (t: DictTable) =>
112112
<Link underline="hover" key={t.id} sx={{cursor: "pointer"}}
113-
color="primary" onClick={()=>{ dispatch(dfActions.setFocusedTable(t.id)) }}>
113+
color="#1770c7" onClick={()=>{ dispatch(dfActions.setFocusedTable(t.id)) }}>
114114
<Typography sx={{fontWeight: t.id == focusedTableId? "bold" : "inherit", fontSize: 'inherit'}} component='span'>{t.id}</Typography>
115115
</Link>;
116116

src/views/EncodingBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,14 +594,14 @@ export const EncodingBox: FC<EncodingBoxProps> = function EncodingBox({ channel,
594594
}}
595595
freeSolo
596596
renderInput={(params) => (
597-
<TextField {...params} variant="standard" autoComplete='off'
597+
<TextField {...params} variant="standard" autoComplete='off' placeholder='field or concept'
598598
sx={{height: "24px", "& .MuiInput-root": {height: "24px", fontSize: "small"}}} />
599599
)}
600600
/>
601601

602602
const filter = createFilterOptions<string>();
603603
// when there is no field added, allow users to directly type concepts here, and it will be created on the fly.
604-
let encContent = field == undefined ?
604+
const encContent = field == undefined ?
605605
(encoding.aggregate == 'count' ? [ aggregateDisplay ] : [
606606
normalizedDisplay,
607607
aggregateDisplay,

0 commit comments

Comments
 (0)