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

Function hide

src/core/api.js:223–251  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

221 * Hide consent modal
222 */
223export const hide = () => {
224 const { _dom, _state, _customEvents } = globalObj;
225
226 if (!_state._consentModalVisible)
227 return;
228
229 _state._consentModalVisible = false;
230
231 if (_state._disablePageInteraction)
232 toggleDisableInteraction();
233
234 /**
235 * Fix focus restoration to body with Chrome
236 */
237 focus(_dom._focusSpan, true);
238
239 removeClass(_dom._htmlDom, TOGGLE_CONSENT_MODAL_CLASS);
240 setAttribute(_dom._cm, ARIA_HIDDEN, 'true');
241
242 /**
243 * Restore focus to last focused element
244 */
245 focus(_state._lastFocusedElemBeforeModal);
246 _state._lastFocusedElemBeforeModal = null;
247
248 debug('CookieConsent [TOGGLE]: hide consentModal');
249
250 fireEvent(_customEvents._onModalHide, CONSENT_MODAL_NAME);
251};
252
253/**
254 * Show preferences modal

Callers 3

acceptActionFunction · 0.85
acceptHelperFunction · 0.85
acceptAndHideFunction · 0.85

Calls 6

toggleDisableInteractionFunction · 0.90
focusFunction · 0.90
removeClassFunction · 0.90
setAttributeFunction · 0.90
debugFunction · 0.90
fireEventFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…