yiisoft / yii2-bootstrap4

Yii 2 Bootstrap 4 Extension
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
216 stars 106 forks source link

Nav::init method default css class fix #202

Closed BartQ76 closed 3 years ago

BartQ76 commented 4 years ago
Q A
Is bugfix? yes
New feature? no
Breaks BC? no

Brief:

Small bug fix, discussed on forum: https://forum.yiiframework.com/t/bootstrap-4-migration-navbar-nav-items-align-problem/130917

What steps will reproduce the problem?:

The Nav::init method adds wrong css class '.nav' to the produced 'ul' element.

What's expected?

Nav::init method adds correct class '.navbar-nav'

Mister-42 commented 4 years ago

Not every nav is a navbar. It should not be added to nav.

BartQ76 commented 4 years ago

Not every nav is a navbar. It should not be added to nav.

@Mister-42 You're right, I will look on it again later.

Mister-42 commented 3 years ago

I've looked into this issue for Yii3 and couldn't find an out of the box solution. However. the solution for your code is already documented.

Edit: from your forum post I see you think the issue might be cause by the nav class. Although technically it shouldn't really be there, I could not reproduce your issue caused by this class.

BartQ76 commented 3 years ago

@Mister-42 thanks you commented this PR. I checked the problem again. The problem appears only when I am logged in to the application. I examine the CSS and found that logout button in navbar has an extra style defined in the web/site.css file:

/* align the logout "link" (button in form) of the navbar */
.nav li > form > button.logout {
    padding: 15px;
    border: none;
}

This particular padding:15px style interferes with the nav elements style 8px padding. This PR is groundless in this situation, so I close it.