diff --git a/src/library-authoring/author-library/LibraryAuthoringPage.jsx b/src/library-authoring/author-library/LibraryAuthoringPage.jsx index 21b2be95..eafc722c 100644 --- a/src/library-authoring/author-library/LibraryAuthoringPage.jsx +++ b/src/library-authoring/author-library/LibraryAuthoringPage.jsx @@ -1,5 +1,5 @@ /* eslint-disable react-hooks/exhaustive-deps */ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useRef } from 'react'; import PropTypes from 'prop-types'; import { ActionRow, @@ -486,6 +486,8 @@ const LibraryAuthoringPageHeader = connect( )(injectIntl(LibraryAuthoringPageHeaderBase)); const ContentTagsDrawer = ({ openContentTagsDrawer, setOpenContentTagsDrawer }) => { + const iFrameRef = useRef(); + if (openContentTagsDrawer) { document.body.classList.add('drawer-open'); } else { @@ -519,26 +521,28 @@ const ContentTagsDrawer = ({ openContentTagsDrawer, setOpenContentTagsDrawer }) }; }, []); + useEffect(() => { + if (openContentTagsDrawer && iFrameRef.current) { + iFrameRef.current.focus(); + } + }, [openContentTagsDrawer]); + // TODO: The use of an iframe in the implementation will likely change const renderIFrame = () => ( - openContentTagsDrawer - ? ( -