Last modified: 2013-07-31 22:20:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T11937, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9937 - Place cursor after section name when editing Summary field
Place cursor after section name when editing Summary field
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: section-editing
  Show dependency treegraph
Reported: 2007-05-17 14:40 UTC by Omegatron
Modified: 2013-07-31 22:20 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Quickie attempt (1.08 KB, patch)
2007-05-17 15:57 UTC, Brion Vibber

Description Omegatron 2007-05-17 14:40:35 UTC
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.
Comment 1 Brion Vibber 2007-05-17 15:57:47 UTC
Created attachment 3645 [details]
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.
Comment 2 p858snake 2011-04-30 00:10:04 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 3 Andre Klapper 2013-07-24 13:17:06 UTC
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.
Comment 4 Bartosz Dziewoński 2013-07-24 13:20:10 UTC
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.
Comment 5 TMg 2013-07-31 21:48:02 UTC
(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.
Comment 6 Daniel Friesen 2013-07-31 22:08:06 UTC
Frankly I'd sooner say that "/* Section title */" should be automatically added always and not included in the summary text area.
Comment 7 Bartosz Dziewoński 2013-07-31 22:20:17 UTC
(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").

Note You need to log in before you can comment on or make changes to this bug.