Skip to content

fix(ObjectStatus): use IconMode.Decorative instead of aria-hidden #7110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import IconMode from '@ui5/webcomponents/dist/types/IconMode.js';
import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
import cancelIcon from '@ui5/webcomponents-icons/dist/sys-cancel.js';
import { Icon, IndicationColor, Label } from '../..';
Expand Down Expand Up @@ -55,11 +56,11 @@ export const WithDefaultIcons: Story = {
};

export const WithCustomIcon: Story = {
args: { icon: <Icon name={cancelIcon} /> }
args: { icon: <Icon name={cancelIcon} mode={IconMode.Decorative} /> }
};

export const WithIconOnly: Story = {
args: { icon: <Icon name={cancelIcon} />, children: null }
args: { icon: <Icon name={cancelIcon} mode={IconMode.Decorative} />, children: null, title: 'Cancel' }
};

export const InvertedObjectStatus: Story = {
Expand Down
13 changes: 8 additions & 5 deletions packages/main/src/components/ObjectStatus/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
VALUE_STATE_SUCCESS,
VALUE_STATE_WARNING
} from '@ui5/webcomponents/dist/generated/i18n/i18n-defaults.js';
import IconMode from '@ui5/webcomponents/dist/types/IconMode.js';
import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
import alertIcon from '@ui5/webcomponents-icons/dist/alert.js';
import errorIcon from '@ui5/webcomponents-icons/dist/error.js';
Expand Down Expand Up @@ -40,7 +41,7 @@ export interface ObjectStatusPropTypes extends CommonProps {
/**
* Defines the icon in front of the `ObjectStatus` text.
*
* __Note:__ Although this slot accepts HTML Elements, it is strongly recommended that you only use `Icon` in order to preserve the intended design.
* __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.
*/
icon?: ReactNode;

Expand Down Expand Up @@ -117,31 +118,33 @@ const getStateSpecifics = (state, showDefaultIcon, userIcon, stateAnnouncementTe
switch (state) {
case ValueState.Negative:
if (renderDefaultIcon) {
icon = <Icon name={errorIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
icon = <Icon name={errorIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />;
}
if (!invisibleText) {
invisibleText = errorStateText;
}
break;
case ValueState.Positive:
if (renderDefaultIcon) {
icon = <Icon name={successIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
icon = <Icon name={successIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />;
}
if (!invisibleText) {
invisibleText = successStateText;
}
break;
case ValueState.Critical:
if (renderDefaultIcon) {
icon = <Icon name={alertIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
icon = <Icon name={alertIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />;
}
if (!invisibleText) {
invisibleText = warningStateText;
}
break;
case ValueState.Information:
if (renderDefaultIcon) {
icon = <Icon name={informationIcon} data-component-name="ObjectStatusDefaultIcon" aria-hidden />;
icon = (
<Icon name={informationIcon} data-component-name="ObjectStatusDefaultIcon" mode={IconMode.Decorative} />
);
}
if (!invisibleText) {
invisibleText = informationStateText;
Expand Down
Loading