Page MenuHomePhabricator

hCaptcha VisualEditor: Execute hCaptcha when in invisible mode mode if hCaptcha widget shown before first "Save changes" attempt
Open, In Progress, Needs TriagePublic3 Estimated Story Points

Description

Summary

Now that we have displayed hCaptcha in the VisualEditor interface where possible during the first time the user opens the window, we should look to programmatically cause execution of hCaptcha when a user presses "Save changes" to complete the edit

Background

Technical notes

TBD

Acceptance criteria

  • When a user opens the VisualEditor "Publish changes" dialog and presses "Publish changes", any invisible hCaptcha widget displayed is executed as long as it was rendered before the first attempt to press "Publish changes" was made

Related Objects

Event Timeline

Dreamy_Jazz set the point value for this task to 1.Oct 14 2025, 2:10 PM
Dreamy_Jazz changed the point value for this task from 1 to 3.Nov 28 2025, 2:03 PM

After looking over this ticket, it seems to be a much larger ticket than previously expected.

We need a way to able to halt or prevent edit submission in VisualEditor so the hCaptcha can execute. Then we need a way to either continue or restart the edit submission with the hCaptcha token once it has finished. This doesn't appear to be possible with the current VisualEditor hooks, so likely work will be needed in VisualEditor to support this.

Proposal from @DLynch:

If you wanted to just duplicate the current getPreSaveProcess methodology with a getSaveOptionsProcess that’s passed saveOptions to modify, that’d probably be most-fitting

Change #1217263 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/VisualEditor@master] [WIP] Add ve.init.mw.ArticleTarget.getSaveOptionsProcess

https://gerrit.wikimedia.org/r/1217263

Change #1217479 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ConfirmEdit@master] [Very WIP] Execute hCaptcha on VisualEditor form submission

https://gerrit.wikimedia.org/r/1217479

(first patch is awaiting review and the second is having some details discussed internally)

Change #1217263 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Add ve.init.mw.ArticleTarget.getSaveOptionsProcess

https://gerrit.wikimedia.org/r/1217263