Fixed "Send invitation" button needing to be clicked twice

refs https://github.com/TryGhost/Ghost/issues/7131
- adds `disableMouseDown` flag to `{{gh-task-button}}`
- uses flag for the send invite button so that the focus-out validation on the e-mail input is not triggered before the click event is triggered
This commit is contained in:
Kevin Ansfield 2019-03-18 17:56:32 +00:00
parent 708c95d2b8
commit 63b8127cfa
2 changed files with 10 additions and 1 deletions

View File

@ -135,6 +135,14 @@ const GhTaskButton = Component.extend({
return false;
},
// mouseDown can be prevented, this is useful for situations where we want
// to avoid on-blur events triggering before the button click
mouseDown(event) {
if (this.disableMouseDown) {
event.preventDefault();
}
},
// when local validation fails there's no transition from failed->running
// so we want to restart the retry spinner animation to show something
// has happened when the button is clicked

View File

@ -54,5 +54,6 @@
successText="Sent"
task=sendInvitation
class="gh-btn gh-btn-green gh-btn-icon"
disabled=fetchRoles.isRunning}}
disabled=fetchRoles.isRunning
disableMouseDown=true}}
</div>