bsNavigationLock guards both router navigation and the browser's beforeunload when the canExit callback returns falsy. The callback receives a chance to inspect form state and ask the user to confirm.
Type something below, toggle "Allow exit" off, then click a different navbar item. Cancel the confirm — your text is still here.