File tree Expand file tree Collapse file tree 2 files changed +22
-11
lines changed Expand file tree Collapse file tree 2 files changed +22
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { styled , Theme } from "../../styles" ;
2
2
import { Icon } from "../../icons" ;
3
- import { filterProps , clickOnEnter } from '../component-utils' ;
3
+ import { clickOnEnter } from '../component-utils' ;
4
4
5
5
interface CloseButtonProps {
6
6
onClose : ( ) => void ;
7
- inverted ?: boolean ;
8
7
top ?: string ;
9
8
right ?: string ;
10
9
11
10
theme ?: Theme ;
12
11
}
13
12
14
- export const CloseButton = styled (
15
- filterProps ( Icon , 'inverted' )
16
- ) . attrs ( ( props : CloseButtonProps ) => ( {
13
+ export const CloseButton = styled ( Icon ) . attrs ( ( props : CloseButtonProps ) => ( {
17
14
icon : [ 'fas' , 'times' ] ,
18
15
size : '2x' ,
19
16
@@ -25,12 +22,15 @@ export const CloseButton = styled(
25
22
z-index: 1;
26
23
cursor: pointer;
27
24
28
- color: ${ ( p : CloseButtonProps ) => p . inverted ?
29
- p . theme ! . mainBackground : p . theme ! . mainColor
30
- } ;
25
+ color: ${ p => p . theme ! . mainColor } ;
31
26
32
- top: ${ p => p . top || '10px' } ;
33
- right: ${ p => p . right || '15px' } ;
27
+ &:focus-visible {
28
+ outline: none;
29
+ color: ${ p => p . theme ! . popColor } ;
30
+ }
31
+
32
+ top: ${ ( p : CloseButtonProps ) => p . top || '10px' } ;
33
+ right: ${ ( p : CloseButtonProps ) => p . right || '15px' } ;
34
34
35
35
&:hover {
36
36
opacity: 0.6;
Original file line number Diff line number Diff line change @@ -231,6 +231,8 @@ export class InterceptOption extends React.Component<InterceptOptionProps> {
231
231
? 4
232
232
: 3 ;
233
233
234
+ const isExpandable = ! ! ConfigComponent && ! isDisabled ;
235
+
234
236
return < InterceptOptionCard
235
237
ref = { this . cardRef }
236
238
@@ -239,6 +241,12 @@ export class InterceptOption extends React.Component<InterceptOptionProps> {
239
241
uiConfig = { uiConfig }
240
242
gridWidth = { gridWidth }
241
243
244
+ role = { ! this . expanded ? 'button' : 'section' }
245
+ aria-expanded = { isExpandable
246
+ ? this . expanded
247
+ : undefined
248
+ }
249
+
242
250
disabled = { isDisabled }
243
251
onKeyDown = { clickOnEnter }
244
252
onClick = { this . expanded ? undefined : this . onClick }
@@ -260,7 +268,10 @@ export class InterceptOption extends React.Component<InterceptOptionProps> {
260
268
261
269
{ ConfigComponent && expanded
262
270
? < >
263
- < CloseButton onClose = { this . onClose } />
271
+ < CloseButton
272
+ title = "Close this interceptor"
273
+ onClose = { this . onClose }
274
+ />
264
275
< ConfigComponent
265
276
interceptor = { interceptor }
266
277
activateInterceptor = { activateInterceptor }
You can’t perform that action at this time.
0 commit comments