Skip to content

Commit be9363a

Browse files
[9.0] [ObsUx][A11y] Add unique accessible lables to metadata table (#217496) (#217621)
# Backport This will backport the following commits from `main` to `9.0`: - [[ObsUx][A11y] Add unique accessible lables to metadata table (#217496)](#217496) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Miriam","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-09T07:41:30Z","message":"[ObsUx][A11y] Add unique accessible lables to metadata table (#217496)\n\nCloses https://github.com/elastic/kibana/issues/194972\n\n## Summary\n\nAdd unique accessible labels to metadata table\n\n### How to test\n\nUse a screen reader to navigate the table\n\nOn Host details, Metadata tab\n\n1. Verify the first column in the table header announces Pin Fields\ncolumn\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 38 28\"\nsrc=\"https://github.com/user-attachments/assets/bdac5799-97d4-4001-b5f0-f9230227b749\"\n/>\n\n2. Verify the Pin column row announces which field pins\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 38 45\"\nsrc=\"https://github.com/user-attachments/assets/a9a18fc4-4f46-49d7-880e-9b77eca476dd\"\n/>\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 39 14\"\nsrc=\"https://github.com/user-attachments/assets/889ca03f-aa00-4360-87b5-6d767fe11cff\"\n/>\n\n3. Verify the \"+ x more\" does announce more of which field\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 39 35\"\nsrc=\"https://github.com/user-attachments/assets/dfba3fd9-7e71-4ef6-956e-3761094f4667\"\n/>","sha":"92a9f8531afa6bb93719db65f4637607c9435beb","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:obs-ux-infra_services","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[ObsUx][A11y] Add unique accessible lables to metadata table","number":217496,"url":"https://github.com/elastic/kibana/pull/217496","mergeCommit":{"message":"[ObsUx][A11y] Add unique accessible lables to metadata table (#217496)\n\nCloses https://github.com/elastic/kibana/issues/194972\n\n## Summary\n\nAdd unique accessible labels to metadata table\n\n### How to test\n\nUse a screen reader to navigate the table\n\nOn Host details, Metadata tab\n\n1. Verify the first column in the table header announces Pin Fields\ncolumn\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 38 28\"\nsrc=\"https://github.com/user-attachments/assets/bdac5799-97d4-4001-b5f0-f9230227b749\"\n/>\n\n2. Verify the Pin column row announces which field pins\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 38 45\"\nsrc=\"https://github.com/user-attachments/assets/a9a18fc4-4f46-49d7-880e-9b77eca476dd\"\n/>\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 39 14\"\nsrc=\"https://github.com/user-attachments/assets/889ca03f-aa00-4360-87b5-6d767fe11cff\"\n/>\n\n3. Verify the \"+ x more\" does announce more of which field\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 39 35\"\nsrc=\"https://github.com/user-attachments/assets/dfba3fd9-7e71-4ef6-956e-3761094f4667\"\n/>","sha":"92a9f8531afa6bb93719db65f4637607c9435beb"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217496","number":217496,"mergeCommit":{"message":"[ObsUx][A11y] Add unique accessible lables to metadata table (#217496)\n\nCloses https://github.com/elastic/kibana/issues/194972\n\n## Summary\n\nAdd unique accessible labels to metadata table\n\n### How to test\n\nUse a screen reader to navigate the table\n\nOn Host details, Metadata tab\n\n1. Verify the first column in the table header announces Pin Fields\ncolumn\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 38 28\"\nsrc=\"https://github.com/user-attachments/assets/bdac5799-97d4-4001-b5f0-f9230227b749\"\n/>\n\n2. Verify the Pin column row announces which field pins\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 38 45\"\nsrc=\"https://github.com/user-attachments/assets/a9a18fc4-4f46-49d7-880e-9b77eca476dd\"\n/>\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 39 14\"\nsrc=\"https://github.com/user-attachments/assets/889ca03f-aa00-4360-87b5-6d767fe11cff\"\n/>\n\n3. Verify the \"+ x more\" does announce more of which field\n\n<img width=\"1262\" alt=\"Screenshot 2025-04-08 at 12 39 35\"\nsrc=\"https://github.com/user-attachments/assets/dfba3fd9-7e71-4ef6-956e-3761094f4667\"\n/>","sha":"92a9f8531afa6bb93719db65f4637607c9435beb"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Miriam <[email protected]>
1 parent 15d185b commit be9363a

File tree

6 files changed

+30
-17
lines changed

6 files changed

+30
-17
lines changed

x-pack/platform/plugins/private/translations/translations/fr-FR.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23258,7 +23258,6 @@
2325823258
"xpack.infra.logSourceErrorPage.tryAgainButtonLabel": "Réessayer",
2325923259
"xpack.infra.logsStreamEmbeddable.deprecationWarningDescription": "La maintenance des panneaux de flux de logs n'est plus assurée. Essayez d'utiliser {savedSearchDocsLink} pour une visualisation similaire.",
2326023260
"xpack.infra.logsStreamEmbeddable.deprecationWarningDescription.discoverSessionsLinkLabel": "Sessions Discover",
23261-
"xpack.infra.metadata.pinAriaLabel": "Champ épinglé",
2326223261
"xpack.infra.metadataEmbeddable.AddFilterAriaLabel": "Ajouter un filtre",
2326323262
"xpack.infra.metadataEmbeddable.errorAction": "récupérer de nouveau les métadonnées",
2326423263
"xpack.infra.metadataEmbeddable.errorMessage": "Une erreur s'est produite lors du chargement des données. Essayez de {refetch} et d'ouvrir à nouveau les détails de l'hôte.",

x-pack/platform/plugins/private/translations/translations/ja-JP.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23239,7 +23239,6 @@
2323923239
"xpack.infra.logSourceErrorPage.tryAgainButtonLabel": "再試行",
2324023240
"xpack.infra.logsStreamEmbeddable.deprecationWarningDescription": "ログストリームパネルは管理されていません。{savedSearchDocsLink}を同様の視覚化に活用してください。",
2324123241
"xpack.infra.logsStreamEmbeddable.deprecationWarningDescription.discoverSessionsLinkLabel": "Discoverセッション",
23242-
"xpack.infra.metadata.pinAriaLabel": "固定されたフィールド",
2324323242
"xpack.infra.metadataEmbeddable.AddFilterAriaLabel": "フィルターを追加",
2324423243
"xpack.infra.metadataEmbeddable.errorAction": "メタデータを再取得",
2324523244
"xpack.infra.metadataEmbeddable.errorMessage": "データの読み込みエラーが発生しました。{refetch}し、ホスト詳細をもう一度開いてください。",

x-pack/platform/plugins/private/translations/translations/zh-CN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23283,7 +23283,6 @@
2328323283
"xpack.infra.logSourceErrorPage.tryAgainButtonLabel": "重试",
2328423284
"xpack.infra.logsStreamEmbeddable.deprecationWarningDescription": "将不再维护日志流面板。尝试将 {savedSearchDocsLink} 用于类似可视化。",
2328523285
"xpack.infra.logsStreamEmbeddable.deprecationWarningDescription.discoverSessionsLinkLabel": "Discover 会话",
23286-
"xpack.infra.metadata.pinAriaLabel": "已固定字段",
2328723286
"xpack.infra.metadataEmbeddable.AddFilterAriaLabel": "添加筛选",
2328823287
"xpack.infra.metadataEmbeddable.errorAction": "重新提取元数据",
2328923288
"xpack.infra.metadataEmbeddable.errorMessage": "加载数据时出错。尝试{refetch}并再次打开主机详情。",

x-pack/solutions/observability/plugins/infra/public/components/asset_details/components/expandable_content.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import useToggle from 'react-use/lib/useToggle';
1414
import type { Field } from '../tabs/metadata/utils';
1515

1616
interface ExpandableContentProps {
17+
fieldName?: string;
1718
values?: Field['value'];
1819
}
1920
export const ExpandableContent = (props: ExpandableContentProps) => {
20-
const { values } = props;
21+
const { fieldName, values } = props;
2122
const [isExpanded, toggle] = useToggle(false);
2223
const showLessRef = useRef<HTMLAnchorElement | null>(null);
2324
const showMoreRef = useRef<HTMLAnchorElement | null>(null);
@@ -50,15 +51,17 @@ export const ExpandableContent = (props: ExpandableContentProps) => {
5051
<>
5152
<EuiLink
5253
data-test-subj="infraAssetDetailsExpandableContentCountMoreLink"
54+
aria-label={i18n.translate('xpack.infra.assetDetails.metadata.seeMore.ariaLabel', {
55+
defaultMessage: 'See {count} more {fieldName}',
56+
values: { fieldName, count: others.length },
57+
})}
5358
onClick={handleToggle}
5459
ref={showMoreRef}
5560
>
5661
<FormattedMessage
5762
id="xpack.infra.assetDetails.tabs.metadata.seeMore"
5863
defaultMessage="+{count} more"
59-
values={{
60-
count: others.length,
61-
}}
64+
values={{ count: others.length }}
6265
/>
6366
</EuiLink>
6467
</>

x-pack/solutions/observability/plugins/infra/public/components/asset_details/tabs/metadata/add_pin_to_row.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ interface AddMetadataPinToRowProps {
1818
onPinned: Dispatch<React.SetStateAction<Array<Field['name']> | undefined>>;
1919
}
2020

21-
const PIN_FIELD = i18n.translate('xpack.infra.metadataEmbeddable.pinField', {
22-
defaultMessage: 'Pin Field',
23-
});
24-
2521
export const AddMetadataPinToRow = ({
2622
fieldName,
2723
pinnedItems,
@@ -52,8 +48,9 @@ export const AddMetadataPinToRow = ({
5248
color="primary"
5349
iconType="pinFilled"
5450
data-test-subj="infraAssetDetailsMetadataRemovePin"
55-
aria-label={i18n.translate('xpack.infra.metadata.pinAriaLabel', {
56-
defaultMessage: 'Pinned field',
51+
aria-label={i18n.translate('xpack.infra.metadata.pinnedAriaLabel', {
52+
defaultMessage: 'Pinned {fieldName}',
53+
values: { fieldName },
5754
})}
5855
onClick={handleRemovePin}
5956
/>
@@ -78,13 +75,20 @@ export const AddMetadataPinToRow = ({
7875

7976
return (
8077
<span className={showOnRowHoverCss}>
81-
<EuiToolTip content={PIN_FIELD}>
78+
<EuiToolTip
79+
content={i18n.translate('xpack.infra.metadataEmbeddable.pinField', {
80+
defaultMessage: 'Pin field',
81+
})}
82+
>
8283
<EuiButtonIcon
8384
color="primary"
8485
size="s"
8586
iconType="pin"
8687
data-test-subj="infraAssetDetailsMetadataAddPin"
87-
aria-label={PIN_FIELD}
88+
aria-label={i18n.translate('xpack.infra.metadataEmbeddable.pinField.ariaLabel', {
89+
defaultMessage: 'Pin {fieldName}',
90+
values: { fieldName },
91+
})}
8892
onClick={handleAddPin}
8993
/>
9094
</EuiToolTip>

x-pack/solutions/observability/plugins/infra/public/components/asset_details/tabs/metadata/table.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ export const Table = ({ loading, rows, onSearchChange, search, showActionsColumn
7777
() => [
7878
{
7979
field: 'value',
80-
name: <EuiIcon type="pin" />,
80+
name: (
81+
<EuiIcon
82+
type="pin"
83+
aria-label={i18n.translate('xpack.infra.metadataEmbeddable.pinFieldsColumn.ariaLabel', {
84+
defaultMessage: 'Pin fields',
85+
})}
86+
/>
87+
),
8188
align: 'center' as HorizontalAlignment,
8289
width: '5%',
8390
sortable: false,
@@ -103,7 +110,9 @@ export const Table = ({ loading, rows, onSearchChange, search, showActionsColumn
103110
name: VALUE_LABEL,
104111
width: '50%',
105112
sortable: false,
106-
render: (_name: string, item: Field) => <ExpandableContent values={item.value} />,
113+
render: (_name: string, item: Field) => (
114+
<ExpandableContent fieldName={item.name} values={item.value} />
115+
),
107116
},
108117
],
109118
[pinnedItems, setPinnedItems]

0 commit comments

Comments
 (0)