Skip to content

Commit 45664cf

Browse files
authored
fix(ObjectStatus): use IconMode.Decorative instead of aria-hidden (#7110)
1 parent eafca89 commit 45664cf

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

packages/main/src/components/ObjectStatus/ObjectStatus.stories.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Meta, StoryObj } from '@storybook/react';
2+
import IconMode from '@ui5/webcomponents/dist/types/IconMode.js';
23
import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
34
import cancelIcon from '@ui5/webcomponents-icons/dist/sys-cancel.js';
45
import { Icon, IndicationColor, Label } from '../..';
@@ -55,11 +56,11 @@ export const WithDefaultIcons: Story = {
5556
};
5657

5758
export const WithCustomIcon: Story = {
58-
args: { icon: <Icon name={cancelIcon} /> }
59+
args: { icon: <Icon name={cancelIcon} mode={IconMode.Decorative} /> }
5960
};
6061

6162
export const WithIconOnly: Story = {
62-
args: { icon: <Icon name={cancelIcon} />, children: null }
63+
args: { icon: <Icon name={cancelIcon} mode={IconMode.Decorative} />, children: null, title: 'Cancel' }
6364
};
6465

6566
export const InvertedObjectStatus: Story = {

packages/main/src/components/ObjectStatus/index.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
VALUE_STATE_SUCCESS,
77
VALUE_STATE_WARNING
88
} from '@ui5/webcomponents/dist/generated/i18n/i18n-defaults.js';
9+
import IconMode from '@ui5/webcomponents/dist/types/IconMode.js';
910
import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
1011
import alertIcon from '@ui5/webcomponents-icons/dist/alert.js';
1112
import errorIcon from '@ui5/webcomponents-icons/dist/error.js';
@@ -40,7 +41,7 @@ export interface ObjectStatusPropTypes extends CommonProps {
4041
/**
4142
* Defines the icon in front of the `ObjectStatus` text.
4243
*
43-
* __Note:__ Although this slot accepts HTML Elements, it is strongly recommended that you only use `Icon` in order to preserve the intended design.
44+
* __Note:__ Although this slot accepts HTML Elements, it is strongly recommended that you only use the `Icon` component with `mode="Decorative"` in order to preserve the intended design.
4445
*/
4546
icon?: ReactNode;
4647

@@ -117,31 +118,33 @@ const getStateSpecifics = (state, showDefaultIcon, userIcon, stateAnnouncementTe
117118
switch (state) {
118119
case ValueState.Negative:
119120
if (renderDefaultIcon) {
120-
icon = <Icon name={errorIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
121+
icon = <Icon name={errorIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />;
121122
}
122123
if (!invisibleText) {
123124
invisibleText = errorStateText;
124125
}
125126
break;
126127
case ValueState.Positive:
127128
if (renderDefaultIcon) {
128-
icon = <Icon name={successIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
129+
icon = <Icon name={successIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />;
129130
}
130131
if (!invisibleText) {
131132
invisibleText = successStateText;
132133
}
133134
break;
134135
case ValueState.Critical:
135136
if (renderDefaultIcon) {
136-
icon = <Icon name={alertIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
137+
icon = <Icon name={alertIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />;
137138
}
138139
if (!invisibleText) {
139140
invisibleText = warningStateText;
140141
}
141142
break;
142143
case ValueState.Information:
143144
if (renderDefaultIcon) {
144-
icon = <Icon name={informationIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
145+
icon = (
146+
<Icon name={informationIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />
147+
);
145148
}
146149
if (!invisibleText) {
147150
invisibleText = informationStateText;

0 commit comments

Comments
 (0)