-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
'nav' class should NOT be added in Init when Nav is used inside NavBar #212
Comments
Is this |
Of course should it be added. See docs: Nav::widget(['class' => ['widget' => '']]); |
The issue is with Nav, but it only presents when Nav is used inside a NavBar, as per yii\bootstrap4\NavBar documentation: As per Bootstrap 4 documentation, a standalone Nav must be of class 'nav' and optionally can have other classes, such as 'nav-pills'. This works ok in Yii2 when using standalone Navs. According to BS 4 docs, the menu inside a NavBar must NOT have a 'nav' class, and should be of class 'navbar-nav' (+ plus optional utility classes). Yii2's BS4 does NOT implement this correctly, since it recommends using a standard Nav component inside a NavBar. In summary, yii\bootstrap4\Nav should NOT have 'nav' class when used inside yii\bootstrap4\NavBar, or a different sub-component should be used to render navigation menus inside NavBars. |
@simialbi |
@simialbi |
Hmmm... What about Nav::widget(['class' => ['widget' => 'navbar-nav']]); ? |
This won't work since Nav uses |
According this test: It works (namespaced class...): |
yii2-bootstrap4/src/Nav.php
Line 120 in 37a0cc2
The 'nav' class is always added in yii\bootstrap4\Nav's init method.
The documentation for yii\bootstrap4\NavBar indicates that yii\bootstrap4\Nav should be used between the begin() and end() calls of NavBar to create the menu, adding class 'navbar-nav'.
But, according to Bootstrap 4.6.x documentation, the 'ul' inside the NavBar should only have class 'navbar-nav', and NOT 'navbar-nav nav' as rendered by this widget.
https://getbootstrap.com/docs/4.6/components/navbar/#nav
The text was updated successfully, but these errors were encountered: