File tree Expand file tree Collapse file tree 10 files changed +94
-10
lines changed
src/client/components/react-dev-overlay/ui Expand file tree Collapse file tree 10 files changed +94
-10
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,26 @@ const preview: Preview = {
18
18
parameters : {
19
19
a11y : {
20
20
element : 'nextjs-portal' ,
21
+ config : {
22
+ standards : {
23
+ ariaAttrs : {
24
+ 'aria-modal' : {
25
+ global : true ,
26
+ } ,
27
+ } ,
28
+ } ,
29
+ rules : [
30
+ {
31
+ // It's incredibly hard to find a code highlighting theme that works
32
+ // for both light and dark themes and passes WCAG color contrast.
33
+ // These kind of tests should really only fail when you regress
34
+ // on a value below threshold.
35
+ id : 'color-contrast' ,
36
+ selector : '.code-frame-lines' ,
37
+ enabled : false ,
38
+ } ,
39
+ ] ,
40
+ } ,
21
41
} ,
22
42
controls : {
23
43
matchers : {
Original file line number Diff line number Diff line change @@ -9,6 +9,18 @@ const meta: Meta<typeof CallStackFrame> = {
9
9
backgrounds : {
10
10
default : 'background-100-dark' ,
11
11
} ,
12
+ a11y : {
13
+ config : {
14
+ rules : [
15
+ {
16
+ id : 'color-contrast' ,
17
+ // Manual testing shows no violation.
18
+ // TODO: We might have setup more explicit backgrounds depending on theme.
19
+ enabled : false ,
20
+ } ,
21
+ ] ,
22
+ } ,
23
+ } ,
12
24
} ,
13
25
decorators : [ withShadowPortal ] ,
14
26
}
Original file line number Diff line number Diff line change @@ -23,10 +23,6 @@ export const CallStackFrame: React.FC<{
23
23
: undefined
24
24
)
25
25
26
- // Format method to strip out the webpack layer prefix.
27
- // e.g. (app-pages-browser)/./app/page.tsx -> ./app/page.tsx
28
- const formattedMethod = f . methodName . replace ( / ^ \( [ \w - ] + \) \/ / , '' )
29
-
30
26
// Formatted file source could be empty. e.g. <anonymous> will be formatted to empty string,
31
27
// we'll skip rendering the frame in this case.
32
28
const fileSource = getFrameSource ( f )
@@ -42,9 +38,13 @@ export const CallStackFrame: React.FC<{
42
38
data-nextjs-call-stack-frame-ignored = { frame . ignored }
43
39
>
44
40
< div className = "call-stack-frame-method-name" >
45
- < HotlinkedText text = { formattedMethod } />
41
+ < HotlinkedText text = { f . methodName } />
46
42
{ hasSource && (
47
- < button onClick = { open } className = "open-in-editor-button" >
43
+ < button
44
+ onClick = { open }
45
+ className = "open-in-editor-button"
46
+ aria-label = { `Open ${ f . methodName } in editor` }
47
+ >
48
48
< ExternalIcon width = { 16 } height = { 16 } />
49
49
</ button >
50
50
) }
Original file line number Diff line number Diff line change @@ -9,6 +9,18 @@ const meta: Meta<typeof CallStack> = {
9
9
backgrounds : {
10
10
default : 'background-100-dark' ,
11
11
} ,
12
+ a11y : {
13
+ config : {
14
+ rules : [
15
+ {
16
+ id : 'color-contrast' ,
17
+ // Manual testing shows no violation.
18
+ // TODO: We might have setup more explicit backgrounds depending on theme.
19
+ enabled : false ,
20
+ } ,
21
+ ] ,
22
+ } ,
23
+ } ,
12
24
} ,
13
25
decorators : [ withShadowPortal ] ,
14
26
}
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const meta: Meta<typeof NextLogo> = {
8
8
layout : 'centered' ,
9
9
} ,
10
10
args : {
11
+ 'aria-label' : 'Open Next.js DevTools' ,
11
12
onClick : ( ) => console . log ( 'Clicked!' ) ,
12
13
} ,
13
14
decorators : [ withShadowPortal ] ,
Original file line number Diff line number Diff line change @@ -6,6 +6,21 @@ const meta: Meta<typeof ErrorMessage> = {
6
6
component : ErrorMessage ,
7
7
parameters : {
8
8
layout : 'fullscreen' ,
9
+ backgrounds : {
10
+ default : 'background-100-light' ,
11
+ } ,
12
+ a11y : {
13
+ config : {
14
+ rules : [
15
+ {
16
+ id : 'color-contrast' ,
17
+ // Manual testing shows no violation.
18
+ // TODO: We might have setup more explicit backgrounds depending on theme.
19
+ enabled : false ,
20
+ } ,
21
+ ] ,
22
+ } ,
23
+ } ,
9
24
} ,
10
25
decorators : [ withShadowPortal ] ,
11
26
}
Original file line number Diff line number Diff line change @@ -50,10 +50,9 @@ import { CollapseIcon } from '../../icons/collapse-icon'
50
50
*/
51
51
export function PseudoHtmlDiff ( {
52
52
reactOutputComponentDiff,
53
- ...props
54
53
} : {
55
54
reactOutputComponentDiff : string
56
- } & React . HTMLAttributes < HTMLPreElement > ) {
55
+ } ) {
57
56
const [ isDiffCollapsed , toggleCollapseHtml ] = useState ( true )
58
57
59
58
const htmlComponents = useMemo ( ( ) => {
@@ -120,12 +119,14 @@ export function PseudoHtmlDiff({
120
119
data-nextjs-container-errors-pseudo-html-collapse = { isDiffCollapsed }
121
120
>
122
121
< button
122
+ aria-expanded = { ! isDiffCollapsed }
123
+ aria-label = "complete Component Stack"
123
124
data-nextjs-container-errors-pseudo-html-collapse-button
124
125
onClick = { ( ) => toggleCollapseHtml ( ! isDiffCollapsed ) }
125
126
>
126
127
< CollapseIcon collapsed = { isDiffCollapsed } />
127
128
</ button >
128
- < pre { ... props } >
129
+ < pre className = "nextjs__container_errors__component-stack" >
129
130
< code > { htmlComponents } </ code >
130
131
</ pre >
131
132
</ div >
Original file line number Diff line number Diff line change @@ -6,6 +6,18 @@ const meta: Meta<typeof Terminal> = {
6
6
component : Terminal ,
7
7
parameters : {
8
8
layout : 'fullscreen' ,
9
+ a11y : {
10
+ config : {
11
+ rules : [
12
+ {
13
+ id : 'color-contrast' ,
14
+ // Manual testing shows no violation.
15
+ // TODO: We might have setup more explicit backgrounds depending on theme.
16
+ enabled : false ,
17
+ } ,
18
+ ] ,
19
+ } ,
20
+ } ,
9
21
} ,
10
22
decorators : [ withShadowPortal ] ,
11
23
}
Original file line number Diff line number Diff line change @@ -202,7 +202,6 @@ export function Errors({
202
202
203
203
{ errorDetails . reactOutputComponentDiff ? (
204
204
< PseudoHtmlDiff
205
- className = "nextjs__container_errors__component-stack"
206
205
reactOutputComponentDiff = { errorDetails . reactOutputComponentDiff || '' }
207
206
/>
208
207
) : null }
Original file line number Diff line number Diff line change @@ -16,6 +16,18 @@ const meta: Meta<typeof DevOverlay> = {
16
16
component : DevOverlay ,
17
17
parameters : {
18
18
layout : 'fullscreen' ,
19
+ a11y : {
20
+ config : {
21
+ rules : [
22
+ {
23
+ id : 'color-contrast' ,
24
+ // Manual testing shows no violation.
25
+ // TODO: We might have setup more explicit backgrounds depending on theme.
26
+ enabled : false ,
27
+ } ,
28
+ ] ,
29
+ } ,
30
+ } ,
19
31
} ,
20
32
}
21
33
You can’t perform that action at this time.
0 commit comments