File tree Expand file tree Collapse file tree
courseware/course/sequence/Unit
plugin-slots/UnitTitleSlot Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,19 @@ describe('<Unit />', () => {
8484
8585 expect ( nextButton ) . toBeVisible ( ) ;
8686 } ) ;
87+
88+ // Test for accessibility compliance: unit title must be an h1 (heading level 1) as the page's primary heading
89+ // for screen reader and accessibility compliance.
90+ // See: https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_components/create_html_component.html#the-visual-editor
91+ // JIRA: https://2u-internal.atlassian.net/browse/AU-2135
92+ it ( 'renders unit title as h1 heading for accessibility' , ( ) => {
93+ renderComponent ( defaultProps ) ;
94+
95+ const unitTitle = screen . getByRole ( 'heading' , { level : 1 } ) ;
96+
97+ expect ( unitTitle ) . toBeInTheDocument ( ) ;
98+ expect ( unitTitle . tagName ) . toBe ( 'H1' ) ;
99+ } ) ;
87100 } ) ;
88101
89102 describe ( 'UnitSuspense' , ( ) => {
Original file line number Diff line number Diff line change 302302 padding-left : 40px ;
303303 padding-right : 40px ;
304304 }
305+
306+ // Unit title is styled as an H3
307+ .unit-title {
308+ font-size : var (--pgn-typography-font-size-h3-base );
309+ }
305310}
306311
307312.unit-iframe-wrapper {
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ const UnitTitleSlot = ({
2727 >
2828 < div className = "d-flex justify-content-between" >
2929 < div className = "mb-0" >
30- < h3 className = "h3 " > { unit . title } </ h3 >
30+ < h1 className = "unit-title " > { unit . title } </ h1 >
3131 </ div >
3232 { isEnabledOutlineSidebar && renderUnitNavigation ( true ) }
3333 </ div >
You can’t perform that action at this time.
0 commit comments