Skip to content

Commit

Permalink
[8.17] [Search] Fix button without a11y aria-label (#201236) (#201643)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.17`:
- [[Search] Fix button without a11y aria-label
(#201236)](#201236)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sander
Philipse","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-25T16:22:16Z","message":"[Search]
Fix button without a11y aria-label (#201236)\n\nAlso adds a tooltip to
the document count to explain why the count might
differ.","sha":"77f08541e146ac071d18d1df52b2ab6284608df7","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Search","backport:version","v8.17.0"],"title":"[Search]
Fix button without a11y
aria-label","number":201236,"url":"https://github.com/elastic/kibana/pull/201236","mergeCommit":{"message":"[Search]
Fix button without a11y aria-label (#201236)\n\nAlso adds a tooltip to
the document count to explain why the count might
differ.","sha":"77f08541e146ac071d18d1df52b2ab6284608df7"}},"sourceBranch":"main","suggestedTargetBranches":["8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201236","number":201236,"mergeCommit":{"message":"[Search]
Fix button without a11y aria-label (#201236)\n\nAlso adds a tooltip to
the document count to explain why the count might
differ.","sha":"77f08541e146ac071d18d1df52b2ab6284608df7"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sander Philipse <[email protected]>
  • Loading branch information
kibanamachine and sphilipse authored Nov 25, 2024
1 parent 86288e1 commit 86bc83d
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 86bc83d

Please sign in to comment.