Page MenuHomePhabricator

hCaptcha VisualEditor: Render hCaptcha in save changes dialog as soon as this is possible
Closed, ResolvedPublic1 Estimated Story Points

Description

Summary

When we know that hCaptcha should be displayed before the edit is started, we need a way to render the hCaptcha widget in the dialog used to enter a edit summary and submit the edit.

Background

  • ConfirmEdit (CAPTCHA extension) has a hCaptcha VisualEditor plugin that handles displaying the hCaptcha challenge in the edit summary window
    • This is displayed if the visualeditoredit fails with a captcha requirement being hcaptcha
    • Therefore, the user will have to press "Save changes", then complete hCaptcha, and then press "Save changes" again
  • This is not an ideal flow, and instead we want to be able to display the hCaptcha widget earlier in the flow
    • We can only do this if we know if the widget should be displayed before the user starts their edit
  • In T407146: hCaptcha VisualEditor: Load hCaptcha secure-api.js when user interacts with edit form, we handled loading hCaptcha in this situation
    • We can now render the hCaptcha widget as soon as this is possible once loading is finished
      • Because we will need to be able to display the widget near the edit field, we may have to wait for the "Save changes" dialog to be opened to be able to render hCaptcha

Technical notes

We need to either:

  • A way to render the hCaptcha widget outside the dialog and then be able to move it inside the dialog once the user opens it
  • Render the hCaptcha widget when the dialog is opened

Additionally, we need to make sure that the save changes dialog persists the hCaptcha widget. If it does not, we may need to ensure that this rendering is triggered again if the user closes and reopens the dialog.

Acceptance criteria

  • When a user opens the VisualEditor "Save changes" dialog and it is known before the edit starts that a hCaptcha captcha will need to be completed, the hCaptcha widget is loaded either when or before the "Save changes" dialog is displayed

Related Objects

Event Timeline

kostajh changed the task status from Open to Stalled.Oct 14 2025, 11:50 AM
Dreamy_Jazz set the point value for this task to 1.Oct 14 2025, 2:10 PM

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

[mediawiki/extensions/ConfirmEdit@master] [WIP] VisualEditor hCaptcha: Render when user opens save dialog

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

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

[mediawiki/extensions/ConfirmEdit@master] ext.confirmEdit.hCaptcha: Move error to message key mapping to utils

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

Change #1198136 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] ext.confirmEdit.hCaptcha: Move error to message key mapping to utils

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

While I've +2'ed the patch, we need a follow-up to allow swapping the sitekey, based on the patch for T408102: ConfirmEdit: Make it possible to define additional configuration in CaptchaTriggers

Change #1197710 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] VisualEditor hCaptcha: Render when user opens save dialog

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