no-browser-dialogs rule prevents usage of the following native browser dialog APIs: alert(), confirm(), and prompt().
Rule details
UI extensions run in a sandboxed web worker environment where native browser dialog APIs (alert(), confirm(), and prompt()) are intentionally replaced with error-throwing functions for security reasons.
These blocking dialogs would freeze the entire UI and negatively impact user experience. Instead, UI extensions provide non-blocking alternatives that integrate seamlessly with the HubSpot interface.
Dialog method alternatives
Use the following UI extension alternatives instead of browser dialog APIs:
See the next section for an example of each alternative.
Examples
Global alerts
Instead of using globalalert():
actions.addAlert() from the SDK:
<Alert> component for inline alerts:
Confirmations
Instead of usingconfirm() as shown below:
<Modal> and <Button> components:
Prompts
Instead of usingprompt():
<Modal> and <Input> components: