Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
klonos opened this issue Oct 23, 2015 · 6 comments
Open

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

klonos opened this issue Oct 23, 2015 · 6 comments

Comments

@klonos
Copy link
Member

klonos commented Oct 23, 2015

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 backdrop-ops/contrib#114

backdrop-ops-contrib-issue114-view_display_as_tab-step7

@klonos
Copy link
Member Author

klonos commented Oct 23, 2015

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 jenlampton changed the title 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. [UX] More than one "active" menu tab Aug 17, 2017
@jenlampton
Copy link
Member

jenlampton commented Aug 17, 2017

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.

@jenlampton jenlampton removed the design label Aug 17, 2017
@klonos klonos changed the title [UX] More than one "active" menu tab [UX] Views: do not allow setting more than one default menu tab Dec 15, 2018
@klonos
Copy link
Member Author

klonos commented Dec 15, 2018

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
Copy link
Member Author

klonos commented Dec 15, 2018

...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
Copy link
Member Author

klonos commented Dec 15, 2018

...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
Copy link
Member Author

klonos commented Dec 15, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants