diff --git a/e2e/components/DefinitionTooltip/DefinitionTooltip-test.avt.e2e.js b/e2e/components/DefinitionTooltip/DefinitionTooltip-test.avt.e2e.js index b995fb9fab68..8ae86b44797d 100644 --- a/e2e/components/DefinitionTooltip/DefinitionTooltip-test.avt.e2e.js +++ b/e2e/components/DefinitionTooltip/DefinitionTooltip-test.avt.e2e.js @@ -10,7 +10,7 @@ const { expect, test } = require('@playwright/test'); const { visitStory } = require('../../test-utils/storybook'); -test.describe('DefinitionTooltip @avt', () => { +test.describe('@avt DefinitionTooltip', () => { test('@avt-default-state', async ({ page }) => { await visitStory(page, { component: 'DefinitionTooltip', @@ -24,7 +24,7 @@ test.describe('DefinitionTooltip @avt', () => { ); }); - test('@avt-keyboard-state default', async ({ page }) => { + test('@avt-keyboard-nav default', async ({ page }) => { await visitStory(page, { component: 'DefinitionTooltip', id: 'components-definitiontooltip--default', @@ -38,10 +38,10 @@ test.describe('DefinitionTooltip @avt', () => { const primaryButton = page.getByRole('button', { name: 'URL' }); // Testing DefinitionTooltip - await page.keyboard.press('Tab'); await expect(primaryButton).toBeVisible(); - await expect(primaryButton).toHaveAttribute('aria-expanded', 'false'); - await primaryButton.click(); + await page.keyboard.press('Tab'); await expect(primaryButton).toHaveAttribute('aria-expanded', 'true'); + await primaryButton.click(); + await expect(primaryButton).toHaveAttribute('aria-expanded', 'false'); }); }); diff --git a/packages/react/src/components/Tooltip/DefinitionTooltip.tsx b/packages/react/src/components/Tooltip/DefinitionTooltip.tsx index 18568dcdd457..103316797d6d 100644 --- a/packages/react/src/components/Tooltip/DefinitionTooltip.tsx +++ b/packages/react/src/components/Tooltip/DefinitionTooltip.tsx @@ -104,6 +104,9 @@ const DefinitionTooltip: React.FC = ({ onMouseEnter={() => { openOnHover ? setOpen(true) : null; }} + onFocus={() => { + setOpen(true); + }} open={isOpen}>