diff --git a/src/bootstrap/Alert.js b/src/bootstrap/Alert.js index 7b7af79..577a753 100644 --- a/src/bootstrap/Alert.js +++ b/src/bootstrap/Alert.js @@ -5,10 +5,12 @@ * See /LICENSE for more information. */ -import React from "react"; +import React, { useRef } from "react"; import PropTypes from "prop-types"; +import { useFocusTrap } from "../utils/hooks"; + export const ALERT_TYPES = Object.freeze({ PRIMARY: "primary", SECONDARY: "secondary", @@ -37,11 +39,15 @@ Alert.defaultProps = { }; function Alert({ type, onDismiss, children }) { + const alertRef = useRef(); + useFocusTrap(alertRef, !!onDismiss); return (
{onDismiss && (