refactor(core): ♻️ prepare for heading structure changes

This commit is contained in:
alistair3149 2022-11-24 21:46:23 -05:00
parent ad714dcfed
commit 9652d4f8ed
No known key found for this signature in database
3 changed files with 12 additions and 4 deletions

View file

@ -10,7 +10,8 @@ function initCollapsibleSections( document ) {
for ( let i = 0; i < headings.length; i++ ) {
const j = i + 1,
collapsibleID = prefix + 'collapsible-' + j,
headline = headings[ i ].querySelector( '.mw-headline' );
/* T13555 */
headline = headings[ i ].querySelector( '.mw-headline' ) ?? headings[ i ].querySelector( '.mw-heading' );
// Set up ARIA
headline.setAttribute( 'tabindex', 0 );

View file

@ -56,7 +56,8 @@ function initToC() {
const initSectionObserver = require( './sectionObserver.js' ).init;
const sectionObserver = initSectionObserver( {
elements: bodyContent.querySelectorAll( '.mw-headline' ),
/* T13555 */
elements: bodyContent.querySelectorAll( '.mw-headline' ) ?? bodyContent.querySelectorAll( '.mw-heading' ),
topMargin: getTopMargin(),
onIntersection: ( section ) => { changeActiveSection( section.id ); }
} );

View file

@ -12,12 +12,18 @@
transform: rotate3d( 1, 0, 0, 180deg );
}
.mw-headline {
.mw-headline,
/* T13555 */
.mw-heading h1,
.mw-heading h2 {
opacity: var( --opacity-icon-base );
}
}
.mw-headline {
.mw-headline,
/* T13555 */
.mw-heading h1,
.mw-heading h2 {
transition: @transition-opacity;
&:hover {