Skip to content

Commit

Permalink
add fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
mxkae committed Nov 5, 2024
1 parent c8ff92e commit 935ae1e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/block/accordion/frontend-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class StackableAccordion {
// Prevent text selection while animating
el.style.userSelect = 'none'

clearTimeout( el.textSelectTimeout )

// When inside columns, flex prevents the accordion closing animation, this hack fixes it.
const doWrapHack = !! el.closest( '.stk-block-columns' )
let wrapper = null
Expand Down Expand Up @@ -61,6 +63,11 @@ class StackableAccordion {
}
el.style.userSelect = 'auto'
}

// Fallback to make sure accordion text is selectable just incase the onfinish or oncancel doesn't fire.
el.textSelectTimeout = setTimeout( () => {
el.style.userSelect = 'auto'
}, 700 )
}
} )
} )
Expand Down

0 comments on commit 935ae1e

Please sign in to comment.