From 90100cf89c2b3f25adb8ac914e2a0c6fcb4f060d Mon Sep 17 00:00:00 2001 From: Rosalind W Date: Wed, 10 Nov 2021 15:09:39 -0600 Subject: [PATCH] Update videos UI to automatically open first or current video (#57928) --- client/components/videos-ui/index.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/components/videos-ui/index.jsx b/client/components/videos-ui/index.jsx index ce34989a6d7b4..d892055337197 100644 --- a/client/components/videos-ui/index.jsx +++ b/client/components/videos-ui/index.jsx @@ -46,12 +46,14 @@ const VideosUi = ( { shouldDisplayTopLinks = false, onBackClick = () => {} } ) = // @TODO add logic to pick the first unseen video const initialVideoId = 'find-theme'; setCurrentVideoKey( initialVideoId ); + setSelectedVideoIndex( Object.keys( course.videos ).indexOf( initialVideoId ) ); } }, [ currentVideoKey, course ] ); useEffect( () => { if ( currentVideoKey && course ) { setCurrentVideo( course.videos[ currentVideoKey ] ); + setSelectedVideoIndex( Object.keys( course.videos ).indexOf( currentVideoKey ) ); } }, [ currentVideoKey, course ] );