Ghost/ghost/admin/app/components/modals/confirm-unsaved-changes.hbs
Kevin Ansfield 4c5144cb61 🐛 Fixed close button on "unsaved changes" modal not always behaving like "Stay" button
no issue

The close button in the unsaved changes modal used the `@close` action directly compared to the "Stay" button which used `(fn @close false)`. The close button version without explicit arguments resulted in the first argument being a `PointerEvent` instance which if checked as a modal return value as `if (shouldClose)` would evaluate as truthy therefore matching the "Leave" behaviour instead of the "Stay" behaviour.

- changed modal to explicitly call `(fn @close false)` when the close button is clicked
- updated design settings route to have an explicit `shouldLeave === true` check so default behaviour is always "Stay"
2022-04-14 12:39:10 +01:00

19 lines
850 B
Handlebars

<div class="modal-content" data-test-modal="unsaved-settings">
<header class="modal-header">
<h1>Are you sure you want to leave this page?</h1>
</header>
<button type="button" class="close" role="button" title="Close" {{on "click" (fn @close false)}} data-test-button="close">{{svg-jar "close"}}<span class="hidden">Close</span></button>
<div class="modal-body">
<p>
Hey there! It looks like you didn't save the changes you made.
</p>
<p>Save before you go!</p>
</div>
<div class="modal-footer">
<button class="gh-btn" data-test-stay-button type="button" {{on "click" (fn @close false)}}><span>Stay</span></button>
<button class="gh-btn gh-btn-red" data-test-leave-button type="button" {{on "click" (fn @close true)}}><span>Leave</span></button>
</div>
</div>