MCPcopy
hub / github.com/orestbida/cookieconsent / focusAfterTransition

Function focusAfterTransition

src/utils/general.js:730–743  ·  view source on GitHub ↗
(element, modalId)

Source from the content-addressed store, hash-verified

728 * @param {1 | 2} modalId
729 */
730export const focusAfterTransition = (element, modalId) => {
731 const getVisibleDiv = (modalId) => modalId === 1
732 ? globalObj._dom._cmDivTabindex
733 : globalObj._dom._pmDivTabindex;
734
735 const setFocus = (event) => {
736 event.target.removeEventListener('transitionend', setFocus);
737 if (event.propertyName === 'opacity' && getComputedStyle(element).opacity === '1') {
738 focus(getVisibleDiv(modalId));
739 }
740 };
741
742 addEvent(element, 'transitionend', setFocus);
743};
744
745/**
746 * Obtain accepted and rejected categories

Callers 2

showFunction · 0.90
showPreferencesFunction · 0.90

Calls 1

addEventFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…