boolean modalSwitchedOff = modalOnBeforeRequest && !modalOn;
// Check if the navigation has changed (f.i: URL typing) and so auto-close the modal (if was opened).
if (modalOn) {
if (!modalSwitchedOn) {
NavigationManager navMgr = NavigationManager.lookup();
boolean navigationChanged = false;
boolean configEnabled = navMgr.isShowingConfig();
boolean wasConfigEnabled = modalStatus.isConfigEnabled();
String currentWorkspaceId = navMgr.getCurrentWorkspaceId();
String oldWorkspaceId = modalStatus.getCurrentWorkspaceId();
Long currentSectionId = navMgr.getCurrentSectionId();
Long oldSectionId = modalStatus.getCurrentSectionId();
if (configEnabled != wasConfigEnabled) navigationChanged = true;
if (ComparatorUtils.compare(currentWorkspaceId, oldWorkspaceId, 1) != 0) navigationChanged = true;
if (ComparatorUtils.compare(currentSectionId, oldSectionId, 1) != 0) navigationChanged = true;