Skip to content

Commit b5359be

Browse files
committed
alert description tag depends on its content
1 parent afa49ac commit b5359be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Alert.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export const Alert = memo(
108108

109109
const refShouldButtonGetFocus = useRef(false);
110110
const refShouldSetRole = useRef(false);
111+
const DescriptionTag = typeof description === "string" ? "p" : "div";
111112

112113
useEffect(() => {
113114
if (props_isClosed === undefined) {
@@ -172,7 +173,7 @@ export const Alert = memo(
172173
{title}
173174
</HtmlTitleTag>
174175
)}
175-
<p className={classes.description}>{description}</p>
176+
<DescriptionTag className={classes.description}>{description}</DescriptionTag>
176177
{isClosable && (
177178
<button
178179
ref={setButtonElement}

0 commit comments

Comments
 (0)