Skip to content

Commit

Permalink
[Search] Fix button without a11y aria-label (elastic#201236)
Browse files Browse the repository at this point in the history
Also adds a tooltip to the document count to explain why the count might differ.
  • Loading branch information
sphilipse authored and paulinashakirova committed Nov 26, 2024
1 parent dc4b0fa commit a964699
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export const ResultField: React.FC<ResultFieldProps> = ({
<EuiPopover
button={
<EuiButtonIcon
aria-label={i18n.translate(
'searchIndexDocuments.result.fieldTypeButtonAriaLabel',
{
defaultMessage: "Show this field's type",
}
)}
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
iconType={iconType || (fieldType ? iconMap[fieldType] : defaultToken)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiText,
useEuiTheme,
useGeneratedHtmlId,
EuiIconTip,
} from '@elastic/eui';

interface BaseQuickStatProps {
Expand All @@ -33,6 +34,7 @@ interface BaseQuickStatProps {
}>;
setOpen: (open: boolean) => void;
first?: boolean;
tooltipContent?: string;
}

export const QuickStat: React.FC<BaseQuickStatProps> = ({
Expand All @@ -45,6 +47,7 @@ export const QuickStat: React.FC<BaseQuickStatProps> = ({
secondaryTitle,
iconColor,
content,
tooltipContent,
...rest
}) => {
const { euiTheme } = useEuiTheme();
Expand Down Expand Up @@ -93,6 +96,11 @@ export const QuickStat: React.FC<BaseQuickStatProps> = ({
{secondaryTitle}
</EuiText>
</EuiFlexItem>
{tooltipContent && (
<EuiFlexItem>
<EuiIconTip content={tooltipContent} />
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiPanel>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface QuickStatsProps {
index: Index;
mappings: Mappings;
indexDocuments: IndexDocuments;
tooltipContent?: string;
}

export const SetupAISearchButton: React.FC = () => {
Expand Down Expand Up @@ -107,6 +108,10 @@ export const QuickStats: React.FC<QuickStatsProps> = ({ index, mappings, indexDo
description: index.size ?? '0b',
},
]}
tooltipContent={i18n.translate('xpack.searchIndices.quickStats.documentCountTooltip', {
defaultMessage:
'This excludes nested documents, which Elasticsearch uses internally to store chunks of vectors.',
})}
first
/>
</EuiFlexItem>
Expand Down

0 comments on commit a964699

Please sign in to comment.