Fix issue when disabling submit button on click (#17205)

Fixes dojo ticket https://bugs.dojotoolkit.org/ticket/17205

Also see https://bugs.webkit.org/show_bug.cgi?id=14443