Steps to replicate the issue (include links if applicable):
- Install a custom skin that does not include a mw-content-subtitle element.
- Open any page in VisualEditor.
- Edit the page and save changes.
What happens?
After saving, VisualEditor “hangs” and the edit dialog is not properly cleaned up. The browser console did not show any errors
What should have happened instead?
VisualEditor should successfully close the editing dialog and update the page, even if the custom skin does not include a subtitle element. The javascript logic shouldn't stop working.
Software version:
MediaWiki 1.43, VisualEditor latest for this version, custom skin applied
Other information:
I'm sure the issue is inside
VisualEditor/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js
Specifically, the following code inside the function replacePageContent:
mw.util.clearSubtitle(); mw.util.addSubtitle(contentSub);
The util function throws an Error when mw-content-subtitle does not exist in the DOM, which stops further cleanup of the VE dialog.
Notes: I could not find anywhere in MediaWiki or VisualEditor documentation that mw-content-subtitle is a required element for custom skins.
Suggested fix:
- In ve.init.mw.ArticleTarget.js, wrap the addSubtitle call in a try/catch or check for the existence of the element before attempting to update the subtitle.
- This might also be considered for MediaWiki core if mw.util.addSubtitle is expected to work without crashing the Javascript
- clarify in the documentation that custom skins must include mw-content-subtitle.