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

First tab in Tabs is active even if URL activates another #192

Open
alex-code opened this issue May 12, 2020 · 4 comments
Open

First tab in Tabs is active even if URL activates another #192

alex-code opened this issue May 12, 2020 · 4 comments
Labels

Comments

@alex-code
Copy link
Contributor

Tabs::widget([
  'renderTabContent' => false,
  'items' => [
    [
      'label' => 'Tab 1',
      'url' => ['/default/index'],
    ],
    [
      'label' => 'Tab 2',
      'url' => ['/default/page2'],
    ],
   ]
]);

The Tabs widget uses the Nav widget to build the tabs which causes a conflict with activating.

If the route matches the url for Tab 2 Nav will activate it but Tab 1 has already been activated by Tabs.

I was thinking of either adding an option to turn off Tabs::activateFirstVisibleTab() or if the items have urls then defer activation to Nav.

Q A
Yii vesion 2.0.35
Yii BS4 version 2.0.8
@samdark samdark added the type:bug Bug label May 15, 2020
@alex-code
Copy link
Contributor Author

@samdark I can do a PR for this but wondering which way is preferable?

An option to disable the Tabs::activateFirstVisibleTab method or if the items use url's then let Nav do the activation?

@simialbi
Copy link
Contributor

In my opinion there should be an active option in items array, if there is none (in none of the items), the first will be activated, otherwhise the one activated.

@alex-code
Copy link
Contributor Author

@simialbi This is the way it works currently but if you try to activate a tab using the route you get multiple tabs activated.

@samdark
Copy link
Member

samdark commented May 17, 2020

If there's explicit active we should not check for route, I think.

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

No branches or pull requests

3 participants