diff --git a/.env b/.env index b162247399..593c30b8c6 100644 --- a/.env +++ b/.env @@ -13,6 +13,7 @@ DISCOVERY_API_BASE_URL='' DISCUSSIONS_MFE_BASE_URL='' ECOMMERCE_BASE_URL='' ENABLE_JUMPNAV='true' +ENABLE_LEGACY_NAV='' ENABLE_NOTICES='' ENTERPRISE_LEARNER_PORTAL_HOSTNAME='' EXAMS_BASE_URL='' diff --git a/.env.development b/.env.development index 34e014efb0..ec6c3a6ced 100644 --- a/.env.development +++ b/.env.development @@ -13,6 +13,7 @@ DISCOVERY_API_BASE_URL='http://localhost:18381' DISCUSSIONS_MFE_BASE_URL='http://localhost:2002' ECOMMERCE_BASE_URL='http://localhost:18130' ENABLE_JUMPNAV='true' +ENABLE_LEGACY_NAV='' ENABLE_NOTICES='' ENTERPRISE_LEARNER_PORTAL_HOSTNAME='localhost:8734' EXAMS_BASE_URL='' diff --git a/README.rst b/README.rst index df3cf427f9..daf747ab3c 100644 --- a/README.rst +++ b/README.rst @@ -119,6 +119,10 @@ ENABLE_JUMPNAV This feature flag is slated to be removed as jumpnav becomes default. Follow the progress of this ticket here: https://openedx.atlassian.net/browse/TNL-8678 +ENABLE_LEGACY_NAV + Enables the legacy behaviour in the course breadcrumbs, where links lead to + the course index highlighting the selected course section or subsection. + SOCIAL_UTM_MILESTONE_CAMPAIGN This value is passed as the ``utm_campaign`` parameter for social-share links when celebrating learning milestones in the course. Optional. diff --git a/src/course-home/outline-tab/OutlineTab.jsx b/src/course-home/outline-tab/OutlineTab.jsx index a2ce8101ea..c7c46a39fc 100644 --- a/src/course-home/outline-tab/OutlineTab.jsx +++ b/src/course-home/outline-tab/OutlineTab.jsx @@ -123,6 +123,15 @@ const OutlineTab = ({ intl }) => { } }, [location.search]); + // A section or subsection is selected by its id being the location hash part. + // location.hash will contain an initial # sign, so remove it here. + const hashValue = location.hash.substring(1); + // Represents whether section is either selected or contains selected + // subsection and thus should be expanded by default. + const selectedSectionId = rootCourseId && courses[rootCourseId].sectionIds.find((sectionId) => ( + (hashValue === sectionId) || sections[sectionId].sequenceIds.includes(hashValue) + )); + return ( <>