-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Tabs/Scrollspy/.nav/.list-group/.active independent of markup (<nav>, .nav-item, <li> etc...) #21807
Conversation
…f nav-item class or of the markup elements (li, nav, div etc…)
…dd an example with sub-nabs
scss/_nav.scss
Outdated
@@ -76,13 +82,6 @@ | |||
.nav-link { | |||
@include border-radius($nav-pills-border-radius); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure but this change breaks navs with dropdowns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about this one?
&.active {
color: $nav-pills-active-link-color;
cursor: default;
background-color: $nav-pills-active-link-bg;
}
Or that one?
.nav-link {
@include border-radius($nav-pills-border-radius);
}
For info the second one wasn't modified in this PR.
Anyway in both cases I can't reproduce the problem you are reporting regarding navs with dropdown.
Could you clarify in which way it breaks it ? Or point me to an exemple in the docs that is broken? Or provide more details?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I see what you means now. I fixed it here. Thanks !
Maybe @vanduynslagerp can rebase his branch (instead of a merge) to fix the build issue |
Sorry about that @vanduynslagerp but can you update your branch again 😄 thank you 👍 |
Done |
Thank I'll review your PR asap 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update this file : https://github.com/twbs/bootstrap/blob/v4-dev/js/tests/visual/tab.html#L199
Because in your branch it doesn't work the same as v4-dev
Sure. I somehow always forget the visual tests. I'll do it tonight (EST time). |
Sorry for the lack of details, the visual test about tabs with list group doesn't work same as |
</div> | ||
|
||
{% highlight html %} | ||
<div class="row"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this div (<div class="row">
) from your example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to make the sample code more concise ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Then I'll remove <div class="col-4">
as well I suppose. I thought it would be helpful for the user to see how to make the vertical menu with the grid. But thinking about it now, it's true it makes the sample bigger and it's not really the place for that anyway. I'll change it tonight
|
||
Scrollspy currently requires the use of a [Bootstrap nav component]({{ site.baseurl }}/components/navs/) for proper highlighting of active links. | ||
<div class="bd-example"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot see this example working because they aren't scroll and when I scroll the main scroll no active
class added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me on Safari, Chrome and Firefox.
The scroll is set by the class .scrollspy-example-2
I added to docs/assets/scss/_component-examples.scss
. I guess you have to recompile the docs with grunt docs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I thought about it after my comment my bad 👍
|
||
The ScrollSpy plugin also works with a `.list-group`. Scroll the area next to the list group and watch the active class change. | ||
|
||
<div class="bd-example"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this example no active
class added
Shorten some examples
I updated the visuals tests and removed the A few explanation regarding the reversal of your code.
In the tabs visual the JS of my PR was actually working (the |
Thank you @vanduynslagerp 👍 I'll review your last changes later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow you must not have the right version of the code. The scroll is created by the class here. So it seems you don't have a local documentation generated from the code of my branch. Make sure you have pulled all the code from my branch then run:
|
I was up to date before you last commit and I did the grunt command you said. |
Everything is fine but your branch is not up to date @vanduynslagerp |
Fixes #20451, fixes #19736, fixes #21223, fixes #18566, fixes #18409, fixes #20620, fixes #20156.
The intent in v4 is to support two type of markup for
.nav
,tab
,scrollspy
:<ul>
markup":<nav>
markup":This PR provide the necessary fixes:
.nav-item
or<li>
anymore.active
.nav-link
for both markup broken here.nav-justified
for both markup that was broken for "<nav>
markup".nav-fill
for both markup that was broken for "<nav>
markup"scrollspy
docs to mention both markup and that.nav-link
receives the.active
classscrollspy
example in the docs with nested.nav-link
s<nav>
and<ul>
markup.nav-item
or<li>
,<a>
etc...list-group
with tabs in a more simple way with less specific class dependenciesIn addition it adds the support of
scrollspy
andtab
to'list-group
(per request in #20620):tab
plugin to support.list-group
tab
example and documentation inlist-group
pagescrollspy
plugin to support.list-group
scrollspy
example and documentationBoth
tab
andscrollspy
plugin now only depends on:.nav
or'list-group
class on the parent or sub-parent in case of nested navs.nav-link
or.list-group-item
anywhere within to add the.active