Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/react/tooltip/stories/Tooltip.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {InformationHighlight} from '@workday/canvas-kit-react/information-highli
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';

import TooltipStoriesMeta from './Tooltip.stories';
import {AIDisclosure} from './examples/AIDisclosure';
import {CustomContent} from './examples/CustomContent';
import {Default} from './examples/Default';
import {DelayedTooltip} from './examples/DelayedTooltip';
Expand Down Expand Up @@ -146,6 +147,15 @@ a dialog instead.

<ExampleCodeBlock code={CustomContent} />

### AI Disclosure

Use a tooltip to disclose when content or functionality is powered by AI. Pair an icon button with a
tooltip near the content it describes so users understand how it was produced before they act on it.
The tooltip labels the button, making the disclosure available to both sighted and screen reader
users.

<ExampleCodeBlock code={AIDisclosure} />

### Delayed Tooltip

The default delay for showing and hiding a tooltip are 300ms and 100ms, respectively. You can
Expand Down
4 changes: 4 additions & 0 deletions modules/react/tooltip/stories/Tooltip.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Meta, StoryObj} from '@storybook/react';
import {Tooltip} from '@workday/canvas-kit-react/tooltip';

import mdxDoc from './Tooltip.mdx';
import {AIDisclosure as AIDisclosureExample} from './examples/AIDisclosure';
import {Alt as AltExample} from './examples/Alt';
import {CustomContent as CustomContentExample} from './examples/CustomContent';
import {Default as DefaultExample} from './examples/Default';
Expand Down Expand Up @@ -34,6 +35,9 @@ export const Default: Story = {
export const CustomContent: Story = {
render: CustomContentExample,
};
export const AIDisclosure: Story = {
render: AIDisclosureExample,
};
export const DelayedTooltip: Story = {
render: DelayedTooltipExample,
};
Expand Down
38 changes: 38 additions & 0 deletions modules/react/tooltip/stories/examples/AIDisclosure.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {ExternalHyperlink, TertiaryButton} from '@workday/canvas-kit-react/button';
import {Card} from '@workday/canvas-kit-react/card';
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
import {createStyles} from '@workday/canvas-kit-styling';
import {infoSparkleIcon} from '@workday/canvas-system-icons-web';
import {system} from '@workday/canvas-tokens-web';

const containerStyles = createStyles({
background: system.color.bg.alt.default,
padding: system.padding.xl,
});

export const AIDisclosure = () => {
return (
<div className={containerStyles}>
<Card>
<Card.Heading>
Giant Pacific Octopus
<Tooltip title="This content is generated by AI" variant="alt" placement="right-end">
<TertiaryButton
size="extraSmall"
icon={infoSparkleIcon}
aria-label="This functionality is powered by AI"
/>
Comment on lines +19 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Align the accessible name with the disclosure text.

The Tooltip displays This content is generated by AI, but the button name is This functionality is powered by AI. Use one canonical disclosure statement for both surfaces.

Proposed fix
-              aria-label="This functionality is powered by AI"
+              aria-label="This content is generated by AI"

As per coding guidelines: interactive elements must have accessible names.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Tooltip title="This content is generated by AI" variant="alt" placement="right-end">
<TertiaryButton
size="extraSmall"
icon={infoSparkleIcon}
aria-label="This functionality is powered by AI"
/>
<Tooltip title="This content is generated by AI" variant="alt" placement="right-end">
<TertiaryButton
size="extraSmall"
icon={infoSparkleIcon}
aria-label="This content is generated by AI"
/>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/react/tooltip/stories/examples/AIDisclosure.tsx` around lines 19 -
24, Update the TertiaryButton aria-label in the AIDisclosure example to use the
same canonical disclosure statement as the Tooltip title, so both surfaces
communicate “This content is generated by AI” while preserving the button’s
accessible name.

Source: Coding guidelines

</Tooltip>
Comment on lines +19 to +25
</Card.Heading>
<Card.Body>
The giant Pacific octopus (Enteroctopus dofleini), also known as the North Pacific giant
octopus, is a large marine cephalopod belonging to the genus Enteroctopus and
Enteroctopodidae family. –{' '}
<ExternalHyperlink href="https://en.wikipedia.org/wiki/Giant_Pacific_octopus">
View Source
</ExternalHyperlink>
</Card.Body>
</Card>
</div>
);
};
Loading