Skip to content

Commit f774803

Browse files
committed
pull in focus changes from gabi PR #25
2 parents e85fa5e + 67c29cf commit f774803

File tree

22 files changed

+82
-41
lines changed

22 files changed

+82
-41
lines changed

src/assets/stylesheets/reset.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ video {
8989

9090
/* make sure to set some focus styles for accessibility */
9191
:focus {
92-
outline: 0;
92+
outline: 2px solid darkblue;
9393
}
9494

9595
/* HTML5 display-role reset for older browsers */

src/components/AccTestComponent/DescribeRenderer/DescribeRenderer.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ const DescribeRenderer = ({
1616
updateDescribeStandardTag,
1717
updateItCatTag,
1818
type,
19-
}): AccTestCaseState => {
20-
19+
}) => {
2120
const deleteDescribeBlockHandleClick = (e: ChangeEvent) => {
2221
e.stopPropagation();
2322
const describeId = e.target.id;
@@ -29,7 +28,14 @@ const DescribeRenderer = ({
2928
dispatcher(addItStatement(describeId));
3029
};
3130

32-
return describeBlocks.allIds.map((id: string, i: number) => (
31+
const deleteDescribeBlockOnKeyUp = (e) => {
32+
if (e.charCode === 13) {
33+
const describeId = e.target.id;
34+
dispatcher(deleteDescribeBlock(describeId));
35+
}
36+
}
37+
38+
return describeBlocks.allIds.map((id: string , i: number) => (
3339
<Draggable
3440
key={id}
3541
draggableId={id}
@@ -56,6 +62,8 @@ const DescribeRenderer = ({
5662
/>
5763

5864
<i
65+
tabIndex={0}
66+
onKeyPress={deleteDescribeBlockOnKeyUp}
5967
onClick={deleteDescribeBlockHandleClick}
6068
id={id}
6169
className={cn('far fa-window-close', styles.describeClose)}

src/components/AccTestComponent/ItRenderer/ItRenderer.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ const ItRenderer = ({
2424
dispatchToAccTestCase(deleteItStatement(describeId, itId));
2525
};
2626

27-
return itStatements.allIds[describeId].map((id: string, i:number) => (
27+
const deleteItStatementOnKeyUp = (e) => {
28+
if (e.charCode === 13) {
29+
const itId = e.target.id;
30+
dispatchToAccTestCase(deleteItStatement(describeId, itId));
31+
}
32+
}
33+
34+
return itStatements.allIds[describeId].map((id: string, i: number) => (
2835
<Draggable
2936
draggableId={id}
3037
index={i}
@@ -47,6 +54,8 @@ const ItRenderer = ({
4754
/>
4855

4956
<i
57+
tabIndex={0}
58+
onKeyPress={deleteItStatementOnKeyUp}
5059
onClick={deleteItStatementHandleClick}
5160
id={id}
5261
className={cn(styles.itClose, 'far fa-window-close')}

src/components/EndpointTestComponent/Endpoint.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,7 @@ const Endpoint = ({ endpoint, index, dispatchToEndpointTestCase }: EndpointProps
7070
dispatchToEndpointTestCase(addAssertion(index));
7171
};
7272

73-
const testDescription = useRef<HTMLInputElement>(null);
7473

75-
useEffect(() => {
76-
if (testDescription && testDescription.current) {
77-
testDescription.current.focus();
78-
}
79-
}, []);
8074

8175
return (
8276
<div style={{ maxWidth: '650px' }}>
@@ -109,7 +103,7 @@ const Endpoint = ({ endpoint, index, dispatchToEndpointTestCase }: EndpointProps
109103
>
110104
<div id={styles.labelInputTest}>
111105
<input
112-
ref={testDescription}
106+
113107
type='text'
114108
id={styles.testStatement}
115109
value={endpoint.testName}

src/components/Modals/ExportFileModal.module.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@
8989
-webkit-appearance: none;
9090
-moz-appearance: none;
9191
}
92+
button:focus {
93+
outline: 2px solid darkblue
94+
}
95+
9296
}
9397

9498
#text {
@@ -101,11 +105,17 @@
101105
color: $mint;
102106
border-radius: 3px;
103107
}
108+
#save:focus{
109+
outline: 1px solid darkblue;
110+
}
104111

105112
#newTestButtons {
106113
display: flex;
107114
justify-content: center;
108115
}
116+
#newTestButtons:focus {
117+
outline: 1px solid darkblue
118+
}
109119

110120
#testMenu {
111121
padding: 10px;

src/components/NavBar/NavBar.module.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
margin-bottom: 40px;
2222
cursor: pointer;
2323
background-color: transparent;
24-
outline: none;
24+
:focus {
25+
outline: 2px solid darkblue
26+
}
2527
}
2628

2729
.icons {

src/components/OpenFolder/OpenFolderButton.module.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
margin-bottom: 40px;
88
cursor: pointer;
99
background-color: transparent;
10-
outline: none;
10+
:focus {
11+
outline: 2px solid darkblue;
12+
}
1113
}
1214

1315
.icons {
@@ -23,11 +25,17 @@
2325
width: 250px;
2426
height: 1.5rem;
2527
color: $dark-gray;
26-
outline: none;
2728
box-shadow: none;
2829
cursor: pointer;
2930
-webkit-appearance: none;
3031
-moz-appearance: none;
32+
:focus {
33+
outline: 2px solid darkblue;
34+
}
35+
}
36+
37+
#openBtn:focus{
38+
outline: 2px solid darkblue
3139
}
3240

3341
.tooltip {

src/components/ReactTestComponent/DescribeRenderer/DescribeRenderer.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@ const DescribeRenderer = ({
1616
handleChangeItStatementText,
1717
type,
1818
}) => {
19-
const testDescription = useRef(null);
2019

21-
useEffect(() => {
22-
testDescription.current.focus();
23-
}, []);
2420

2521
const deleteDescribeBlockHandleClick = (e) => {
2622
e.stopPropagation();
2723
const describeId = e.target.id;
2824
dispatcher(deleteDescribeBlock(describeId));
2925
};
3026

27+
const deleteReactDescribeBlockOnKeyUp = (e) => {
28+
if (e.charCode === 13) {
29+
const describeId = e.target.id;
30+
dispatcher(deleteDescribeBlock(describeId));
31+
}
32+
}
3133
const addItStatementHandleClick = (e) => {
3234
const describeId = e.target.id;
3335
dispatcher(addItstatement(describeId));
@@ -52,12 +54,14 @@ const DescribeRenderer = ({
5254
</label>
5355

5456
<i
57+
tabIndex={0}
58+
onKeyPress={deleteReactDescribeBlockOnKeyUp}
5559
onClick={deleteDescribeBlockHandleClick}
5660
id={id}
5761
className={cn('far fa-window-close', styles.describeClose)}
5862
></i>
63+
5964
<input
60-
ref={testDescription}
6165
id={id}
6266
className={styles.describeInput}
6367
name='describe-label'

src/components/ReactTestComponent/ItRenderer/ItRenderer.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ const ItRenderer = ({
3030
const itId = e.target.id;
3131
dispatchToReactTestCase(deleteItStatement(describeId, itId));
3232
};
33+
34+
const deleteReactItStatementOnKeyUp = (e) => {
35+
if (e.charCode === 13) {
36+
const itId = e.target.id;
37+
dispatchToReactTestCase(deleteItStatement(describeId, itId));
38+
}
39+
}
3340
const addActionHandleClick = (e) => {
3441
const itId = e.target.id;
3542
dispatchToReactTestCase(addAction(describeId, itId));
@@ -54,6 +61,8 @@ const ItRenderer = ({
5461
{...provided.dragHandleProps}
5562
>
5663
<i
64+
tabIndex={0}
65+
onKeyPress={deleteReactItStatementOnKeyUp}
5766
onClick={deleteItStatementHandleClick}
5867
id={id}
5968
className={cn(styles.itClose, 'far fa-window-close')}

src/components/SearchInput/SearchInput.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const SearchInput = ({
111111
<div className='search-container'>
112112
<div className='search'>
113113
<input
114+
114115
type='text'
115116
className='search-box'
116117
onChange={handleChange}

0 commit comments

Comments
 (0)