Last modified: 2011-07-19 18:40:24 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 T31672, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29672 - use tab name, not tab index for anchors on Special:Preferences
use tab name, not tab index for anchors on Special:Preferences
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
1.20.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks: 27559
  Show dependency treegraph
 
Reported: 2011-07-01 19:33 UTC by Umherirrender
Modified: 2011-07-19 18:40 UTC (History)
5 users (show)

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


Attachments
Working patch (remove spaces only) (1.52 KB, patch)
2011-07-05 19:41 UTC, Jarry1250
Details
Working patch (use canonical) (4.90 KB, patch)
2011-07-09 17:24 UTC, Jarry1250
Details

Description Umherirrender 2011-07-01 19:33:56 UTC
Since r81573 the tabs on Special:Preferences has anchors, but the tab index is used to build that anchors. When install a extension which create an own tab some links can get broken, because the index can change.

Please use the name of that tab to build the anchor, that cannot break, because a new tab has another name.

So you can use [[Special:Preferences#preftab-edit]] or so.

Thanks.
Comment 1 Brion Vibber 2011-07-01 21:07:31 UTC
I'm also marking this as a blocker on bug 27559 (saving the currently selected tab across submissions); while not strictly a requirement, making the hashes more actively used would benefit from also making them link-friendlier by using nice ASCII english words.
Comment 2 Jarry1250 2011-07-05 19:41:43 UTC
Created attachment 8742 [details]
Working patch (remove spaces only)

This patch should do the trick. Obviously, any level of "normalisation" is possible - it's a trade off between readability/clashes/potentially breaking the anchor. I've opted for low level normalisation - only spaces, hashes and hyphens.

The JavaScript-disabled version is unaffected. Tested in latest FF, IE and Chrome; any-which-way it's a simple patch.
Comment 3 DieBuche 2011-07-07 15:41:29 UTC
Problems with patch:
1. HTML4 only allows very limited characters for ID's. I don't think browsers hickup on that though, since it's a very common mistake.

2. Links will be Userlanguage dependent. Something like "Go to this link ../Special:Preferences#Editing , then change X and click save" etc. will break if the others user lang is italian.
Comment 4 Umherirrender 2011-07-07 18:55:27 UTC
(In reply to comment #3)
> 2. Links will be Userlanguage dependent. Something like "Go to this link
> ../Special:Preferences#Editing , then change X and click save" etc. will break
> if the others user lang is italian.

Using the canonical/technical name of the tab should be ok, because in other situation it is also used (URL param, log types and so on)
Comment 5 Jarry1250 2011-07-08 17:02:28 UTC
Thanks for the review.

I shall have a prod around regarding Canonical names.

With respect to allowed characters, all I can find is "restricted to ASCII characters". Elsewhere in Wikipedia we use a fairly heavy process to ensure adherence to this. On the other hand, canonical names are almost certainly going to be written in English. So it's probably fine.
Comment 6 Jarry1250 2011-07-08 20:19:49 UTC
Okay, so the major problem is that canonical names are not exposed to the JavaScript.

There seems to be no easy way of exposing them, either. The form extends HTMLForm, and uses its abstracted functions. As a consequence, which massive overriding HTMLForm, there's no way for the PHP to know which <legend>s the JavaScript is going to need metadata about.

That's my take, anyway.
Comment 7 DieBuche 2011-07-08 21:14:34 UTC
(In reply to comment #6)
> Okay, so the major problem is that canonical names are not exposed to the
> JavaScript.

Here you go: r91757 :)
Comment 8 Jarry1250 2011-07-09 17:24:33 UTC
Created attachment 8763 [details]
Working patch (use canonical)

Utilise canonical names as provided above.
Comment 9 DieBuche 2011-07-11 09:55:33 UTC
Looks good. Committed in r91869
Comment 10 Bergi 2011-07-19 16:06:39 UTC
Nice, but could you please add a legacy function for old links (from FAQ etc, links that help-seeking users found in archives)? Maybe something like (untested)

 	var tab, hash = window.location.hash;
 	if( tab = hash.match( /^#preftab-(.+)/ ) ) {
 		var $tab = $( hash + '-tab' );
 		if (! $tab.length && tab[1])
 			$tab = $('#preftoc a').eq(parseInt(tab[1]));
 		$tab.click();
 	}
Comment 11 db [inactive,noenotif] 2011-07-19 18:40:24 UTC
(In reply to comment #10)
> Nice, but could you please add a legacy function for old links (from FAQ etc,
> links that help-seeking users found in archives)? Maybe something like
> (untested)
>      var tab, hash = window.location.hash;
>      if( tab = hash.match( /^#preftab-(.+)/ ) ) {
>          var $tab = $( hash + '-tab' );
>          if (! $tab.length && tab[1])
>              $tab = $('#preftoc a').eq(parseInt(tab[1]));
>          $tab.click();
>      }

For backward compatible see r91869#c19481

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


Navigation
Links