backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

[UX] Views: do not allow setting more than one default menu tab #1310

Open klonos opened 9 years ago

klonos commented 9 years ago

Views: Creating a second display of the same view and setting it as a default menu tab shows all menu tabs by that view as active.

Also noticed while replying in https://github.com/backdrop-ops/contrib/issues/114

backdrop-ops-contrib-issue114-view_display_as_tab-step7

klonos commented 9 years ago

Notice how both the "Find content" tab as well as the "Node detail" tab are shown with white background, as active, no matter which one is chosen. They both get class="active", so perhaps we should generalize this as a "Make sure only one local task tab is active at a time"?

jenlampton commented 7 years ago

The active state is determined by the menu system, and is usually determined by path. Sanity check: @klonos Are you sure both displays have unique paths?

If so, this might be a bigger problem, having nothing to do with design.

klonos commented 5 years ago

You can get into this situation when setting more than one displays of the same view to be a "Default menu tab":

screen shot 2018-12-15 at 5 53 32 am
klonos commented 5 years ago

...OK, so this seems to occur if both displays have the same "parent path". So for example, if you clone the "Page" display of the "Administer content", you get a page that has the same path (/admin/content/node), and is also set to be a "default tab". This is one common way to cause the problem.

Even after you edit the path of one of the displays and change it to /admin/content/another-node, you get the same issue.

If you change the path to /admin/content/another/node or to /completely/different/path, the issue does not happen of course.

I have started working on a fix on my local, and I have gotten to a point where the "default menu tab" option is disabled when adding new displays if there is already a display -within the same view- which has been set to be the default menu tab:

screen shot 2018-12-15 at 3 22 53 pm

Now I need to figure out if it is viable to also get the menu path into play, and to also search across displays of different views.

klonos commented 5 years ago

...the logic started getting too complicated, and I have thought of (edge perhaps, but still legitimate) use cases where one might want to actually set more than one displays as default menu tabs in the same view, and the same path (they might want to later limit access based on user permission/role for example).

So I am now thinking to try to tackle this during rendering of the tabs. So the active class should be set to only the tab that has a path that matches the current path. This should sort the problem in a less "expensive" way I believe. I'll give that a go.

klonos commented 5 years ago

...this seems to be related to https://www.drupal.org/project/drupal/issues/2804195