Skip to content

fix(admin): replace alert() in starter modal with in-page messages (#29) - #30

Merged
arsalan-arshad merged 1 commit into
mainfrom
fix/starter-modal-alerts
Nov 9, 2026
Merged

arsalan-arshad merged 1 commit into
mainfrom
fix/starter-modal-alerts

Conversation

@arsalan-arshad

Copy link
Copy Markdown
Owner

Summary

Closes #29

Replaces all native browser alert() dialogs in the Merchant Admin Starter Template modal with accessible, in-page error messages compatible with modern embedded admin iframes on admin.shopify.com.

Changes

  1. Eliminated alert() Calls:

    • Invalid variant GID (Invalid variant: must be a product variant GID)
    • Duplicate variant warning (This product variant is already in the starter template.)
    • 20-product limit cap (Maximum 20 lines allowed per starter template.)
    • Missing variant on manual add (Please enter a variant GID.)
    • Malformed variant on manual add (Variant ID must be numeric or gid://shopify/ProductVariant/<id>)
    • Product variant load failure (Could not load product variants)
    • Empty starter template form submission (Please add at least one product line item to the starter template.)
  2. Unified In-Page Message Handling (app/lib/protocols/admin.js):

    • Added showStarterMessage(msg, isError, asHtml) and clearStarterMessage().
    • Uses #admin-starter-search-message rendered in normal document flow.
    • Sets appropriate styles (critical red for validation errors, amber for notices/warnings).
    • Dynamically sets role="alert" for errors and role="status" for notices for screen-reader accessibility.
    • Automatically clears errors on new search input, manual field input, item addition, or modal close.
  3. Automated Testing (test/admin.test.js):

    • Added unit test asserting zero alert() calls in the starter modal logic and verifying in-page error message strings.
    • 591 unit tests passing across 132 test suites.

@arsalan-arshad
arsalan-arshad merged commit 5b2fc69 into main Nov 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UX: replace alert() calls in starter template modal with in-page error messages

1 participant