New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Long-running form submit spinners #1075
Conversation
@@ -70,7 +70,8 @@ $(function(){ | |||
/* close all dropdowns on body clicks */ | |||
$(document).on('click', function(e){ | |||
var relTarg = e.relatedTarget || e.toElement; | |||
if(!$(relTarg).hasClass('dropdown-toggle')){ | |||
if(!$(relTarg).hasClass('dropdown-toggle') && !$(relTarg).closest('.dropdown').length){ | |||
console.log($(relTarget).closest('.dropdown')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove
Looks good! |
@JoshBarr do you have time to review this? |
|
@tomdyson sure thing, I can take a look at the media embedding modal. Are there any others you can think of while I'm there? |
Hey guys, I was wondering whether we need to use setTimeout to disable the button? I think we can get the parent // Trigger form submission if it's a submit button
if (this.form && this.getAttribute('type') === 'submit') {
$(this.form).trigger('submit');
}
// Then carry on and disable the button + bootup the timeout to clear the spinner... Also, I've found an issue with trying to embed multiple media assets into the rich text field (in Chrome at least). If the first element is an embed (no other text nodes at the start of the block), trying to insert a second embed generates an |
Cheers for reviewing, @JoshBarr. As far as submitting the form goes, I suppose I don't have many issue with that, but I was trying to avoid having to refer to forms at all purely to keep it all within the scope of the button. I was hoping to avoid having to test the button type too, allowing this to be used for ajax forms, synchronous ones, and ones where true "submit" buttons aren't used. |
d0040b9
to
8df933f
Compare
Ready for merge, I believe. |
There's a problem with the form submit logic from #1075 (comment) - the form submission won't include the name/value of the submit button, as it would when the submit action is triggered directly from the button. We use this to differentiate between the save/publish/submit actions on the page editor - consequently, with this patch applied, the 'publish' button fails to publish. I think this should be reverted to the original setTimeout-based implementation. |
Ah yes, that was the main reason I didn't use |
This reverts commit 8df933f.
b6b73e7
to
5aea7dd
Compare
Reverted to version that supports passing of button names, also rebases on top of all the gulp & linting stuff which was added after this PR. |
First pass at addressing #305
Still to apply this to more forms