Page MenuHomePhabricator

In preview mode, the WikiEditor toolbar is prepended to sections called "wpTextbox1"
Closed, ResolvedPublic

Description

#wpTextbox1 is the ID used for the main editing textarea, and various things use it to inject elements on the page. One of these things seems to be WikiEditor, which uses it to create the editing toolbar. However, if you have another element on the page whose ID is "wpTextbox1", the toolbar will be injected before that element. A simple way to reproduce this is to create a section called "wpTextbox1" and then open it in preview mode. You'll see that the toolbar wraps the header. For instance, you can open this page in preview mode.

I recognize that this is an edge case, but perhaps it wouldn't be a bad idea to make the relevant code a bit more robust; for instance, have the actual editing textarea be passed by a core hook and use that instead of querying the DOM by ID, or at least change the selector to .mw-editform #wpTextbox1 or something similar.

Event Timeline

Change #1276599 had a related patch set uploaded (by Happy5214; author: Happy5214):

[mediawiki/extensions/WikiEditor@master] Restrict wpTextbox1 selector to textarea elements

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

Change #1276599 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Restrict wpTextbox1 selector to textarea elements

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

happy5214 moved this task from Doing to Closed on the WikiEditor (2010) board.