Page MenuHomePhabricator

When a ProfileMenu has a link item that adds URI parameters, highlight it when clicked

Authored by epriestley on Mar 30 2019, 7:18 PM.



Depends on D20352. Fixes T12949. If a user adds a link (for example, to a workboard) that takes you to the same page but with some URI parameters, we'd prefer to highlight the "link" item instead of the default "workboard" item when you click it.

For example, you add a /query/assigned/ "link" item to a workboard, called "Click This To Show Tasks Assigned To Me On This Workboard", i.e. filter the current view.

This is a pretty reasonable thing to want to do. When you click it, we'd like to highlight that item to show that you've activated the "Assigned to Me" filter you added.

However, we currently highlight the thing actually serving the content, i.e. the "Workboard" item.


  • When picking what to highlight, look through all the items for one with a link to the current request URI.
  • If we find one or more, pick the one that would be the default.
  • Otherwise, pick the first one.

This means that you can have several items like "?a=1", "?a=2", etc., and we will highlight them correctly when you click them.

This actual patch has some questionable bits (see some discussion in T13275), but I'd like to wait for stronger motivation to refactor it more extensively.

Test Plan
  • On a portal, added a ?a=1 link. Saw it highlight properly when clikced.
  • On a workboard, added a link to the board itself with a different filter. Saw it highlight appropriately when clicked.

Diff Detail

rP Phabricator
Lint Not Applicable
Tests Not Applicable

Event Timeline

Here's exactly what this is talking about in fewer words.

This workboard has a default item called "Workboard" pointed at /project/board/25/.

I've added a link item called "Workboard (My Tasks)" pointed at /project/board/25/query/assigned/.

By default, the board looks like this:

Screen Shot 2019-03-30 at 12.20.55 PM.png (759×1 px, 193 KB)

I can click "Workboard (My Tasks)" to quickly jump to a view of the board showing only tasks assigned to me:

Screen Shot 2019-03-30 at 12.20.56 PM.png (759×1 px, 165 KB)

Before, this view worked but the menu item did not highlight correctly. Now, it highlights correctly.

This revision is now accepted and ready to land.Apr 1 2019, 7:26 PM
This revision was automatically updated to reflect the committed changes.