()
| 221 | * Hide consent modal |
| 222 | */ |
| 223 | export 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 |
no test coverage detected
searching dependent graphs…