It would be nice to have an anchor that is contained in a tab activate that tab. My specific use case is having a tab in position 2 for comments. After a user submits the comment form the fragment '#comment-$cid' is added to the URL. Ideally the tab that contains this fragment should be activated.

I have attached a patch that is working for me to accomplish this but I'm not 100% convinced it's a be all end all solution. Either way, wanted to get a discussion going on this.

tabs.patch1.14 KBelliotttf
Members fund testing for the Drupal project. Drupal Association Learn more


tvu007’s picture

Turn on the attribute history, set it to true. Then link using an achor... href="#tab3" it will go to tab3 and activate it as the current active tab. This assumes you have the anchors actually referenced in the

  • ,
  • Data Products
  • Services
  • Solutions
  • stealthtech1’s picture

    tvu007 can you explain what you meant by turning on the history attribute?

    klonos’s picture

    ...really useful feature. Thanx ;)

    elliotttf’s picture

    @tvu007, that's not exactly what this patch accomplishes. What this is attempting to do is satisfy the case where your tab contains an anchor. This change will activate the containing tab.

    So to expand on your example, setting the anchor to #foo in this list would activate Tab 2