Page MenuHomePhabricator

Heading field (section=new) should not use the same name/id as edit summary field (action=edit)
Open, LowPublicFeature

Description

The Heading-field uses the same name/id as the Summary causing javascript tools targetting the summary to mess up.

ie. a button to insert a template adds "; template Foobar added" to the summary, which is great otherwise, but when adding a new talkpage heading there is no summary so I'd expect the script to be unable to find a summary and do nothing.

Instead it does find a "summary" field and appends it to it.
Likewise there are gadgets replacing the summary with "/* Test */ section added" and inserting {{subst:test}}~~~~

This is great when editing the page, since it appends the template to the talkpage and sets the summary correct, but when using the "new section" button (&section=new) it litterly sets the title of message to "/* Test */ new section".

If these different field would have different name/id attribute values they can be targetted, detected and used appropiately.


Version: 1.18.x
Severity: enhancement

Details

Reference
bz26312

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:21 PM
bzimport set Reference to bz26312.
bzimport added a subscriber: Unknown Object (MLST).

In other words, EditPage.php should provide separate inputs for the section
title and the edit summary, rather than using wpSummary for both.

(In reply to comment #1)

In other words, EditPage.php should provide separate inputs for the section
title and the edit summary, rather than using wpSummary for both.

Krinkle is saying there should only be one input on the section=new form, but it should have a different id: "I'd expect the script to be unable to find a summary and do nothing."

EditPage.php can now handle separate section titles and edit summaries (as of 1.19). It should be rather trivial to change the edit form to take advantage of this.

(In reply to comment #3)

EditPage.php can now handle separate section titles and edit summaries (as of
1.19). It should be rather trivial to change the edit form to take advantage of
this.

Adding "easy" keyword then.

I want to work on this bug. I get the idea that only an extra section title field has to be added to the form. I presume we only need to add extra methods along the lines of getSummaryInput,showSummaryInput,... in EditPage.php, to show the section title field in Edit page and call the newly built showSectionTitleInput() in showEditForm()?

I suggest to add the existing <input type='hidden' value="..." name="wpSection"/> an id. Because this seems the only (optimal) solution to check with JavaScript of this page status. The alternative not optimal solution would be per jQuery:

if ( $( "input[name='wpSection']" ).find( "input[value='new']" ).length ) { /* new */ }

The other not sure possibility would be (not recommended):

/&section=new/.test(location.search)

I figured out now, there is no problem here with JavaScript. You can simply check

$("#wpMinoredit").length

to proof the new section summary (because there is no).

Aklapper renamed this task from Heading-field (section=new) uses same name/id as edit summary (action=edit) to Heading field (section=new) should not use the same name/id as edit summary field (action=edit).Dec 21 2016, 6:28 PM
Aklapper lowered the priority of this task from Medium to Low.
Aklapper removed a subscriber: wikibugs-l-list.

Trying to explain this for a contributor, as this is marked as good first task:

Going to e.g. https://www.mediawiki.org/w/index.php?title=User_talk:Malyacko&action=edit&section=new , there are:

<span class="mw-summary" id="wpSummaryLabel">
 <label for="wpSummary">Subject:</label>
</span>
<input class="mw-summary" id="wpSummary" maxlength="255" tabindex="1" size="60" spellcheck="true" title="Enter a short summary [Alt+Shift+b]" accesskey="b" name="wpSummary">

Going to e.g. https://www.mediawiki.org/w/index.php?title=User_talk:Malyacko&action=edit&section=1 :

<span class="mw-summary" id="wpSummaryLabel">
 <label for="wpSummary">Summary <sup><small>(<a href="https://meta.wikimedia.org/wiki/Help:Edit_summary" class="extiw" title="meta:Help:Edit summary">?</a>)</small></sup>:</label>
</span>
<input class="mw-summary" id="wpSummary" maxlength="255" tabindex="1" size="60" spellcheck="true" title="Enter a short summary [Alt+Shift+b]" accesskey="b" value="/* Some preset text for the edit summary */ " name="wpSummary">

And as Perhelion already wrote, for the time being, in the second case the following item also exists and could be checked for, as a workaround:

<input name="wpMinoredit" value="1" tabindex="3" accesskey="i" id="wpMinoredit" type="checkbox">
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:00 AM