Consider a nav like this with scrollspy enabled:
<ul class="nav">
...
<li class="nav-item">
<a class="nav-link" href="#link-2">Link 2</a>
<ul class="nav">
<li class="nav-item">
<a href="#link-2-a" class="nav-link">Link 2-A</a>
</li>
<li class="nav-item">
<a href="#link-2-b" class="nav-link">Link 2-B</a>
</li>
</ul>
</li>
...
</ul>
When scrolling without this patch applied and any of these links come into view, they will all receive .active. With this patch applied, the active link and links above it in the tree will receive .active. This matches the behavior of Bootstrap 3.
Before:
After: