Page MenuHomePhabricator

Place cursor after section name when editing Summary field
Closed, DeclinedPublic

Description

Author: ui2t5v002

Description:
When you click or Tab to the Summary field in the edit window, the browser's functionality is to highlight the entire summary field, including the automatically-generated /* Section title */ bit.

Ideally, it would only highlight the part *after* the section title so you can just start typing instead of overwriting the auto-generated section title or using the mouse or arrow keys to navigate past the section heading.

I wrote a bit of Javascript to accomplish this in Firefox on en, but it would need to be generalized to all wikis and browsers to go live site-wide.

More details including code at the URL.


Version: unspecified
Severity: enhancement
URL: http://en.wikipedia.org/wiki/MediaWiki_talk:Common.js/Archive_Apr_2007#Placing_the_cursor_after_the_section_name

Details

Reference
bz9937

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:43 PM
bzimport set Reference to bz9937.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 3645
Quickie attempt

Here's a quickie attempt at it... some caveats:

First, it doesn't seem to be working in Internet Explorer at all. The event fires, but text selection seems to work differently there; there's some other code dealing with that for the edit toolbar stuff, but I don't feel like diving in it just now.

The code above does seem to work in Firefox 2.0.3, Safari 2.0.4, and Opera 9.20.

Second, it might be desirable to tweak the behavior a bit. Normally the "select all text" behavior only happens when you _tab_ into a field; clicking usually positions the caret and doesn't set a selection. The onclick or onfocus events change the behavior more than I'd prefer, by setting a selection when I'm just trying to position the cursor.

Checking for the previously-set selection, eg if it's the whole text, might do the trick nicely.

Attached:

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

Setting "patch-reviewed" keyword as comment 1 lists more work that needs to be done for that patch.

Getting it into Gerrit would be welcome, I guess.

Not sure if this is worth the trouble, and the change in behavior will be probably more annoying than the behavior itself. I recomment WONTFIX.

mr.heat wrote:

(In reply to comment #4)

I recomment WONTFIX.

I recommend the same. How a browser behaves when tabbing a form is not the responsibility of the website. How the tab key behaves depends on the operating system, on the browser and if and what kind of assisting software (screenreaders and such) is used. A script will actually break the expected behavior in some cases.

The only "right" way to do this is a HTML attribute. This acts as a recommendation and will not break existing workflows. Browsers can choose to ignore it. HTML5 added a lot of similar features to forms. But I'm afraid a feature to change the behavior of the tab key was not added.

Frankly I'd sooner say that "/* Section title */" should be automatically added always and not included in the summary text area.

(In reply to comment #6)

Frankly I'd sooner say that "/* Section title */" should be automatically
added always and not included in the summary text area.

That might be annoying e.g. if you edit the last section to modify categories, bottom templates or language links – none of these actually have to apply to the section (which might be called, say, "References").