Skip to content
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
11 changes: 1 addition & 10 deletions packages/react-core/src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
timeoutAnimation?: number;
/** Title of the alert. */
title: React.ReactNode;
/** @deprecated Sets the heading level to use for the alert title. Default is h4. */
titleHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
/** Sets the element to use as the alert title. Default is h4. */
component?: keyof JSX.IntrinsicElements;
/** Adds accessible text to the alert toggle. */
Expand Down Expand Up @@ -98,7 +96,6 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
actionClose,
actionLinks,
title,
titleHeadingLevel,
component = 'h4',
children = '',
className = '',
Expand Down Expand Up @@ -126,13 +123,7 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
);

const titleRef = React.useRef(null);
const TitleComponent = (titleHeadingLevel || component) as any;
if (titleHeadingLevel !== undefined) {
// eslint-disable-next-line no-console
console.warn(
'Alert: titleHeadingLevel is deprecated, please use the newer component prop instead to set the alert title element.'
);
}
const TitleComponent = component as any;

const divRef = React.useRef<HTMLDivElement>();
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ test('Renders the title as an h4 by default', () => {
expect(screen.getByRole('heading', { level: 4, name: 'Default alert: Some title' })).toBeVisible();
});

test('Renders the title as other heading levels when one is passed using titleHeadingLevel', () => {
test('Renders the title as other heading levels when one is passed using component', () => {
render(
<Alert title="Some title" titleHeadingLevel="h1">
<Alert title="Some title" component="h1">
Some alert
</Alert>
);
Expand Down