Skip to content

Commit

Permalink
Show modals only if hidden, hide only if visible
Browse files Browse the repository at this point in the history
  • Loading branch information
orestbida committed Aug 7, 2022
1 parent 0639a62 commit e2c1b33
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,6 @@ export const api = {
*/
show: (createModal) => {

if(!globalObj._init) return;

if(createModal && !globalObj._state._consentModalExists){
_createConsentModal(api);
_getModalFocusableData();
Expand Down Expand Up @@ -522,7 +520,7 @@ export const api = {
* Show preferences modal
*/
showPreferences: () => {
if(!globalObj._init) return;
if(globalObj._state._preferencesModalVisible) return;

_addClass(globalObj._dom._htmlDom, TOGGLE_PREFERENCES_MODAL_CLASS);
_setAttribute(globalObj._dom._pm, 'aria-hidden', 'false');
Expand Down Expand Up @@ -560,7 +558,7 @@ export const api = {
*/
hidePreferences: () => {

if(!globalObj._init) return;
if(!globalObj._state._preferencesModalVisible) return;

_removeClass(globalObj._dom._htmlDom, TOGGLE_PREFERENCES_MODAL_CLASS);
globalObj._state._preferencesModalVisible = false;
Expand Down

0 comments on commit e2c1b33

Please sign in to comment.