Unverified Commit 6d5d578a authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

[dev-overlay] add aria to disabled docs button (#76055)

The tooltip from the `title` property was missing when the docs button
was disabled.

Closes NDX-798

---------
Co-authored-by: 's avatarSebastian "Sebbie" Silbermann <silbermann.sebastian@gmail.com>
parent 1afef128
...@@ -13,25 +13,14 @@ const meta: Meta<typeof CopyStackTraceButton> = { ...@@ -13,25 +13,14 @@ const meta: Meta<typeof CopyStackTraceButton> = {
export default meta export default meta
type Story = StoryObj<typeof CopyStackTraceButton> type Story = StoryObj<typeof CopyStackTraceButton>
const errorWithStack = new Error('Test error')
errorWithStack.stack = `Error: Test error
at Context.<anonymous> (test.ts:1:1)
at processImmediate (node:internal/timers:466:21)`
export const WithStackTrace: Story = { export const WithStackTrace: Story = {
args: { args: {
error: errorWithStack, error: new Error('Boom'),
}, },
} }
export const WithoutStackTrace: Story = { export const WithoutStackTrace: Story = {
args: { args: {
error: new Error('Error without stack'), error: Object.assign(new Error('Boom'), { stack: undefined }),
},
}
export const Disabled: Story = {
args: {
error: undefined,
}, },
} }
...@@ -21,7 +21,12 @@ export function DocsLinkButton({ errorMessage }: { errorMessage: string }) { ...@@ -21,7 +21,12 @@ export function DocsLinkButton({ errorMessage }: { errorMessage: string }) {
if (!docsURL) { if (!docsURL) {
return ( return (
<button className="docs-link-button" disabled> <button
title="No related Next.js docs found"
aria-label="No related Next.js docs found"
className="docs-link-button"
disabled
>
<DocsIcon <DocsIcon
className="error-overlay-toolbar-button-icon" className="error-overlay-toolbar-button-icon"
width={14} width={14}
...@@ -33,8 +38,8 @@ export function DocsLinkButton({ errorMessage }: { errorMessage: string }) { ...@@ -33,8 +38,8 @@ export function DocsLinkButton({ errorMessage }: { errorMessage: string }) {
return ( return (
<a <a
title="Related Next.js Docs" title="Go to related Next.js docs"
aria-label="Related Next.js Docs" aria-label="Go to related Next.js docs"
className="docs-link-button" className="docs-link-button"
href={docsURL} href={docsURL}
target="_blank" target="_blank"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment