Merge "[TOC] Remove pointer-events:none on .sidebar-toc-link"

This commit is contained in:
jenkins-bot 2022-05-04 19:38:32 +00:00 committed by Gerrit Code Review
commit a68409d262
2 changed files with 6 additions and 11 deletions

View File

@ -294,9 +294,13 @@ module.exports = function tableOfContents( props ) {
/** @type {HTMLElement | null} */ ( e.target.closest( `.${SECTION_CLASS}` ) );
if ( tocSection && tocSection.id ) {
if ( e.target.classList.contains( LINK_CLASS ) ) {
// In case section link contains HTML,
// test if click occurs on any child elements.
if ( e.target.closest( `.${LINK_CLASS}` ) ) {
props.onHeadingClick( tocSection.id );
}
// Toggle button does not contain child elements,
// so classList check will suffice.
if ( e.target.classList.contains( TOGGLE_CLASS ) ) {
props.onToggleClick( tocSection.id );
}

View File

@ -30,21 +30,12 @@
border: 0;
}
.sidebar-toc-link {
word-break: break-word;
> * {
// Prevent click events on the link's contents so that we can use event
// delegation and have the target be the anchor element instead.
pointer-events: none;
}
}
.sidebar-toc-numb {
display: none;
}
.sidebar-toc-link {
word-break: break-word;
color: @color-link;
}