Skip to content

Commit

Permalink
alert description tag depends on its content
Browse files Browse the repository at this point in the history
  • Loading branch information
enguerranws committed Jul 24, 2023
1 parent afa49ac commit f46dda8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const Alert = memo(

const refShouldButtonGetFocus = useRef(false);
const refShouldSetRole = useRef(false);
const DescriptionTag = typeof description === "string" ? "p" : "div";

useEffect(() => {
if (props_isClosed === undefined) {
Expand Down Expand Up @@ -172,7 +173,8 @@ export const Alert = memo(
{title}
</HtmlTitleTag>
)}
<p className={classes.description}>{description}</p>

<DescriptionTag className={classes.description}>{description}</DescriptionTag>
{isClosable && (
<button
ref={setButtonElement}
Expand Down

0 comments on commit f46dda8

Please sign in to comment.