The issue has been closed
Problem
- Write a comment
- Attach file
- Click the "Comment" button before it's done uploading
This is the result: (image will be missing)
![Uploading Screen Shot 2.png…]()
Solution
When the user tries to submit a comment, the form should be disabled. Interestingly enough, the "New issue" form has this feature already, so we might be able to reuse it somehow.
Notice the green button fading:


the "New issue" form has this feature already, so we might be able to reuse it somehow.
The "New Comment/Update Comment" form has this feature too/

It just doesn't work due to conflict with
S("[data-required-trimmed]", function (t) {
const e = t.currentTarget;
"" === e.value.trim() ? e.setCustomValidity(e.getAttribute("data-required-trimmed")) : e.setCustomValidity("");
}),
n("change", "[data-required-trimmed]", function (t) {
const e = t.currentTarget;
"" === e.value.trim() ? e.setCustomValidity(e.getAttribute("data-required-trimmed")) : e.setCustomValidity(""), O(e.form);
}),
posted by artusm about 4 years ago
Not in Safari?

posted by fregante about 4 years ago
It just doesn't work due to conflict with
Did you take those 2 screenshots after changing something? Does it work or not? 🤔
posted by fregante about 4 years ago
I see what's going on now.
- Upload code calls
e.setCustomValidity('uploading')
, disabling submission
data-required-trimmed
calls e.setCustomValidity('')
, enabling submission immediately after
All of this overlapping logic is why I was hoping that this could be solved by GitHub themselves rather than adding more code like in #3886.
posted by fregante about 4 years ago
Silly idea: Since the cause of this behavior overlap is data-required-trimmed
, what if we dropped the attribute during the upload? I wonder if it's possible to fit right between the steps 1 and 2 described above.
select.all('[data-required-trimmed]')
- On upload:start, drop
data-required-trimmed
- On upload:complete/error, add
data-required-trimmed
posted by fregante about 4 years ago