Fix React modal error.

This commit is contained in:
Matthew Stratford 2020-09-23 00:57:03 +01:00
parent b3038c6ab5
commit c16af23f21

View file

@ -42,6 +42,7 @@ import { OptionsMenu } from "../optionsMenu";
import { WelcomeModal } from "./WelcomeModal"; import { WelcomeModal } from "./WelcomeModal";
import { PisModal } from "./PISModal"; import { PisModal } from "./PISModal";
import "./channel.scss"; import "./channel.scss";
import Modal from "react-modal";
function Channel({ id, data }: { id: number; data: PlanItem[] }) { function Channel({ id, data }: { id: number; data: PlanItem[] }) {
return ( return (
@ -196,6 +197,10 @@ const Showplanner: React.FC<{ timeslotId: number }> = function({ timeslotId }) {
planSaveError, planSaveError,
planSaving, planSaving,
} = useSelector((state: RootState) => state.showplan); } = useSelector((state: RootState) => state.showplan);
// Tell Modals that #root is the main page content, for accessability reasons.
Modal.setAppElement('#root');
const session = useSelector((state: RootState) => state.session); const session = useSelector((state: RootState) => state.session);
const [showWelcomeModal, setShowWelcomeModal] = useState( const [showWelcomeModal, setShowWelcomeModal] = useState(