diff --git a/src/block/accordion/frontend-accordion.js b/src/block/accordion/frontend-accordion.js index 97a8c7299..8967f7f1e 100644 --- a/src/block/accordion/frontend-accordion.js +++ b/src/block/accordion/frontend-accordion.js @@ -31,8 +31,7 @@ class StackableAccordion { const preHeight = el.dataset.preHeight // Prevent text selection while animating - const content = el.querySelector( '.stk-block-accordion__content' ) - content.style.userSelect = 'none' + el.style.userSelect = 'none' // When inside columns, flex prevents the accordion closing animation, this hack fixes it. const doWrapHack = !! el.closest( '.stk-block-columns' ) @@ -55,20 +54,9 @@ class StackableAccordion { }, ANIM_OPTS ) } - // When the animation is done, remove text selection from double click - // and allow text selection again + // When the animation is done, allow text selection again. el.anim.onfinish = el.anim.oncancel = () => { - if ( window.getSelection ) { - // eslint-disable-next-line @wordpress/no-global-get-selection - const selection = window.getSelection() - if ( selection.removeAllRanges ) { - selection.removeAllRanges() - } - } else if ( document.selection ) { - // For older IE browsers - document.selection.empty() - } - content.style.userSelect = 'auto' + el.style.userSelect = 'auto' } if ( doWrapHack ) {