Page MenuHomePhabricator

Allow URL query param for tab name
Closed, ResolvedPublic

Description

We need to be able to link users to the Suggested Tabs page with the personal uploads tab active. To do this, we need to check for a query param uploads which can have the value user or popular. These values correspond to the tab names. Then, in SuggestedTagsPage.js, we can use the TabPanelLayout.setTabPanel( tabName ) method to show the correct tab.

Event Timeline

AnneT created this task.Oct 10 2019, 8:16 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 10 2019, 8:16 PM

Change 543746 had a related patch set uploaded (by Eric Gardner; owner: Eric Gardner):
[mediawiki/extensions/MachineVision@master] Allow URL Query Params to determine active tab

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

There are two ways this feature could be implemented:

  1. We only care about the URL params at the time that the SuggestedTags page loads, to determine where the user came from. The URL is parsed when the user first arrives at Special:SuggestedTags and then is disregarded.
  2. The URL reflects which tab the user is viewing at all times, and the appropriate query params update as the user switches from one tab to another. This could also impact the behavior of the browser back button (if the user starts on one tab and switches to another, should hitting the back button go to the first tab?).

Right now I've only handled the first use-case. If we need the URL to update in real time as the user moves between tabs, let me know.

If the interface in question is not server-side rendered or if the query param otherwise does not varies the server response, and if sharing a link to the current tab is not yet possible (per the above comment). Then perhaps this might make more sense as a hash fragment? We could use something like #!/tab/foo for this purpose, although given it is a special page you might not need to worry about ambiguity with headings from user-generated content and could thus also use something simpler like #foo or #tab-foo. See Special:Preferences for an example of this.

Server-side rendering is not a requirement for this particular component, and the queries made to the server are the same regardless of which tab the user starts on. I agree that a hash fragment may be more appropriate here (and more obvious to the user in terms of meaning). A hash fragment representing a given view should probably change as the user goes back and forth between tabs, but that's pretty simple to implement.

Krinkle removed a subscriber: Krinkle.

Change 543746 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@master] Allow URL hash to determine active tab

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

AnneT moved this task from In development to Tracking on the MachineVision board.Oct 23 2019, 7:18 PM
AnneT moved this task from Tracking to Done on the MachineVision board.
Ramsey-WMF closed this task as Resolved.Dec 13 2019, 10:45 PM

Works on Production.