rusackas commented on code in PR #43271:
URL: https://github.com/apache/superset/pull/43271#discussion_r3885475017
##########
superset-frontend/src/dashboard/components/SliceHeader/index.tsx:
##########
@@ -335,6 +341,19 @@ const SliceHeader = forwardRef<HTMLDivElement,
SliceHeaderProps>(
<CrossFilterIcon iconSize="m" />
</Tooltip>
)}
+ {slice.description && !isExpanded && (
+ <Popover
+ trigger={['hover', 'click']}
+ content={<SliceInfo slice={slice} />}
+ placement="leftBottom"
+ >
+ <Icons.InfoCircleOutlined
+ iconSize="m"
+ aria-label={t('Chart description')}
+ data-test="chart-description-info-icon"
+ />
+ </Popover>
+ )}
Review Comment:
Suggested fix for the keyboard-accessibility gap copilot flagged:
`Icons.InfoCircleOutlined` has no `tabIndex`/keydown handling on its own, so
keyboard users can't reach the click trigger. Matches the controlled-Popover
pattern `DrillBySubmenu.tsx` uses plus `handleKeyboardActivation` from
`ControlHeader.tsx`, both already established in this codebase.
Two other one-line changes needed alongside this (outside this hunk, so not
apply-able here):
Add `handleKeyboardActivation` to the existing `@superset-ui/core` import
near the top of the file:
```tsx
import {
getExtensionsRegistry,
handleKeyboardActivation,
JsonObject,
QueryData,
VizType,
} from '@superset-ui/core';
```
Add a bit of open/close state next to the existing `headerTooltip` state:
```tsx
const [isDescriptionOpen, setIsDescriptionOpen] = useState(false);
```
```suggestion
{slice.description && !isExpanded && (
<Popover
trigger={['hover', 'click']}
content={<SliceInfo slice={slice} />}
placement="leftBottom"
open={isDescriptionOpen}
onOpenChange={setIsDescriptionOpen}
>
<Icons.InfoCircleOutlined
iconSize="m"
role="button"
tabIndex={0}
aria-label={t('Chart description')}
data-test="chart-description-info-icon"
onKeyDown={handleKeyboardActivation(() =>
setIsDescriptionOpen(open => !open),
)}
/>
</Popover>
)}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]