Skip to content

Commit f454f5e

Browse files
authored
minor: fix label and title on docs popover button (#2804)
1 parent ccfa5a5 commit f454f5e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

app/components/DocsPopover.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,21 @@ export const DocsPopoverLink = ({ href, linkText }: DocsPopoverLinkProps) => (
3636
)
3737

3838
type DocsPopoverProps = {
39-
heading: React.ReactNode
39+
heading: string
4040
icon: JSX.Element
4141
links: Array<DocsPopoverLinkProps>
4242
summary: string
4343
}
4444

4545
export const DocsPopover = ({ heading, icon, summary, links }: DocsPopoverProps) => {
46+
const title = `Learn about ${heading}`
4647
return (
4748
<Popover>
48-
<PopoverButton className={cn(buttonStyle({ size: 'sm', variant: 'ghost' }), 'w-8')}>
49-
<Info16Icon aria-label="Links to docs" className="shrink-0" />
49+
<PopoverButton
50+
className={cn(buttonStyle({ size: 'sm', variant: 'ghost' }), 'w-8')}
51+
title={title}
52+
>
53+
<Info16Icon aria-hidden className="shrink-0" />
5054
</PopoverButton>
5155
<PopoverPanel
5256
// popover-panel needed for enter animation
@@ -56,7 +60,7 @@ export const DocsPopover = ({ heading, icon, summary, links }: DocsPopoverProps)
5660
<div className="px-4">
5761
<h2 className="mt-4 flex items-center gap-1 text-sans-md">
5862
<div className="mr-1 flex items-center text-accent-secondary">{icon}</div>
59-
Learn about {heading}
63+
{title}
6064
</h2>
6165
<p className="mb-3 mt-2 text-sans-md text-default">{summary}</p>
6266
</div>

test/e2e/docs-popover.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { expect, test } from './utils'
99

1010
test('Show / hide contextual help docs links', async ({ page }) => {
11-
const learnAbout = page.getByText('Learn about disks')
11+
const learnAbout = page.getByRole('heading', { name: 'Learn about disks' })
1212
const managingDisksLink = page.getByRole('link', { name: 'Disks and Snapshots' })
1313

1414
await page.goto('/projects/mock-project/disks')
@@ -17,7 +17,7 @@ test('Show / hide contextual help docs links', async ({ page }) => {
1717
await expect(managingDisksLink).toBeHidden()
1818

1919
// open the contextual help docs links
20-
await page.getByLabel('Links to docs').click()
20+
await page.getByRole('button', { name: 'Learn about disks' }).click()
2121
await expect(learnAbout).toBeVisible()
2222
await expect(managingDisksLink).toBeVisible()
2323

test/e2e/images.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test('can promote an image from silo', async ({ page }) => {
4646
await page.getByRole('option', { name: 'mock-project' }).click()
4747

4848
// Select an image in that project
49-
const imageListbox = page.locator('role=button[name*="Image"]')
49+
const imageListbox = page.getByRole('button', { name: 'Image', exact: true })
5050
await expect(imageListbox).toBeEnabled()
5151
await imageListbox.click()
5252
await page.locator('role=option >> text="image-1"').click()

0 commit comments

Comments
 (0)