Problem/Motivation
When visiting a page which belongs to a child menu tree, menu block displays other trees on the same level, from different parents, when the parents are set to expanded and the starting level is greater than 1.
E.g. using the following menu hierarchy:

Observed Behavior:
When visiting either "About Event" page, the menu block displays items from Event 1 (active trail) and Event 2 (outside active trail):

Expected behavior:
When the user sets the menu block to level 2, they to see menu items from the active trail only:
Screenshot of expected behavior:

Proposed resolution
- If menu block level is greater than 1, show only the menu items along the active menu trail, regardless of "expanded" settings on other menu trails.
- For menu items with starting level > 1, remove the ability to show a fully-expanded menu tree
Remaining tasks
Improve the UI text which explains what the "Expanded" option means on the menu block configuration.
For menu items with level > 1, "Expanded" means "show all children of this menu item, only if this menu item or one of its children is in the active menu trail"
API changes
N/A
| Comment | File | Size | Author |
|---|
Comments
Comment #2
akeemw commentedWe were able to reproduce this issue while working on a new Drupal 8 project as well. It seems like the menu block is not taking into account the active menu trail when the starting level configured is higher than 1.
We added the code below to SystemMenuBlock.php right below the conditional on $depth in the "build" method and it seems to handle the cases as expected. However, we are uncertain whether or not this is appropriate spot for this fix or if there is a differently layer that this should addressed in so any and all feedback is appreciated.
Comment #3
kiwad commentedComment #4
dawehnerNeeds review means there is some form of patch already.
Comment #5
acke commentedWe discovered that if we marked "Show as expanded", the menu is displayed at sublevels where it should not appear. The code above fix the main level. Our patch also fix sublevels.
Comment #7
tom robert commentedAdded some cleaning and configuration options.
I'm not quite sure about the hiding part of it is needed. I left it out so it reverts to the default behavior.
Made a mistake in the patch
Comment #8
tom robert commentedComment #10
snufkin commentedUpdated the patch. with >=. The patch seems to solve the issue for us.
Comment #11
johnmcc commentedI had a problem after applying the patch in #7 (with the correction). Nodes that didn't exist within the menu structure had menu blocks that once again showed every sub-menu item.
I'm not sure if this is a configuration issue, or something else.
Comment #12
snufkin commentedHave you configured the menu block to "follow" the trail?
The menu block still shows the all child items when there is no active menu item used though, we may want to look at that scenario as well.
Comment #14
johnmcc commentedYes, I have.
Comment #15
snufkin commentedI have the same, although not with nodes, but with other entity landing pages.
If we change the code to have an exception handling when the active trail count is higher or equal to the level, we could hide the menu entirely, e.g. by
then I get the expected behaviour on my local test. Could you check? I'm not sure if this is the right way of doing it, feels dirty to just return in there.
Comment #16
johnmcc commentedThanks, @snufkin, that does seem to work for me. Here's a patch for further review.
Comment #17
johnmcc commentedSorry - better formatted patch.
Comment #18
snufkin commentedSorry to be nitpicking, but the else should go on a new line according to Drupal CS.
Comment #19
johnmcc commentedThanks, all feedback is very welcome! It's been a while since I did this. Hope this one's better.
Comment #20
snufkin commentedSetting the issue to needs review to trigger the testing bot. The updated patch works well for us.
Comment #24
johnmcc commentedLet's try it without the whitespace this time.
Comment #25
johnmcc commentedComment #27
snufkin commentedLets try it this way :)
Comment #29
esolitosI have added the schema definition to the config, this should fix the errors in the previous patches (Based on #27).
We also need some tests for this new feature!
I would also propose to increase the priority to Major, since the menu block level handling is basically useless without this option. I can't think of more than 1 occasion where the current approach is the correct one.
Naturally feel free, to revert it back to Normal if you do not agree with this.
Comment #30
lokapujyaDidn't review the whole patch, but if you want to return nothing, shouldn't this return [] instead of NULL?
Comment #32
snufkin commentedTo my knowledge there is no difference between return NULL and return. And looking at code from core there are cases where the build function will not have a return, if certain conditionals are not triggered. No return value is basically the same as a return; or return NULL; call.
Since the @return type for the build method does state it is a renderable array, I would say that it should be an array regardless, however there are examples from core where this is not true, so for me the implementation in the patch seems to be acceptable.
Comment #33
lokapujyaTrue, the Core code is robust enough to handle it. However, you will not find any block() methods that explicitly return without returning an array; Instead you will find
return [];orreturn array();. Plus on the page you linked to it reads, "it must then only return an empty array".I tested the patch manually and it does give the right menu:
Started looking at where the tests should be added. Not sure, but it might be possible to test this in one of the PHPUnit Tests in: \Drupal\Tests\Core\Menu\. It was pretty easy to set up the menu for manual testing, but not sure yet exactly how to set it up in a test.
Comment #34
snufkin commentedWell let this not be the reason for this patch not moving forward. Replacing the
return;withreturn array();.Comment #35
snufkin commentedChanging title to summarise the issue a bit better.
Comment #36
mohit_aghera commentedChanging status to trigger test bot.
Comment #38
esolitosI'll fix the bot errors tonight, i have seen what it is.
Comment #39
lokapujyaAny ideas about writing the tests? Maybe we can figure it out.
Comment #40
snufkin commentedThe test errors are due to the fact that we are providing an integer value in the default configuration for the follow item in the block, while the schema declares this as a boolean. Patch is now using a boolean in the default block configuration.
Comment #41
snufkin commentedArgh, changed the wrong element.
Comment #44
lokapujyaNice, down from 44 to 2 fails.
I think this is the only change that was made. But if possible, please provide interdiff with future patches so we can see the changes.
Comment #45
snufkin commentedThe tests failed because the default configuration provided by the install profile was not updated for the latest block configuration schema. Updating patch to add the follow property to the blocks that triggered the test fails. For now all of these are set to false, we may want to think if we need to set any to true.
Comment #46
esolitosSorry I got caught in the events, the patch provided by snufkin in #45 was exactly was I was going to upload right now, if it wasn't already there. :)
so for me is a RTBC! :)
Comment #47
catchThe newly added text is very confusing - I barely understand it myself.
Also is it necessary to show this all the time, or could it depend on the value of the level/depth options?
Tagging needs issue summary update - I'd like to know what the use case is for not having this behaviour - i.e. why make it a configuration option vs. just changing the behaviour?
Comment #48
snufkin commentedI've updated the summary a little bit. I have not stated whether or not this is a new feature (so we need the UI), or a bug (we don't need the UI) until it is decided in the comments.
I personally can't think of a use-case where we would want to show other subtrees from other parents, so I would be happy to reroll the patch without the UI changes.
Comment #49
esolitosI do agree that the use cases where one would want to show other subtrees from other parents are.... non existent?
I am totally for simply
changingfixing the logic of the block, however changing this would possibly(?) break some sites, so maybe we should simply set it as enabled by default, leaving also the UI?Comment #50
catchThat feels like the kind of behaviour change we could reasonably do in a minor release (which to introduce the UI we'd have to make it a minor release anyway, so moving to 8.1.x).
If someone really is relying on the current behaviour, then we could treat that as a bug report/regression once it's reported and add the UI in response. If no-one is though, we save ourselves some logic and interface to maintain, as well as any confusion the additional option might cause for people seeing it.
Comment #51
akeemw commentedI'm in agreement with others here that there may be no use cases for the current core behavior. Because of this I believe the default core behavior to me is a bug because right now on D8 (as far as I know) there is no way to show a contextual left hand navigation like we were able to do with Menu Block on D7.
Comment #52
star-szrThe wording called out in #47 looks to be from the D7 menu_block contrib module, I can't see any mention of that so just making sure that is known. Not saying that makes it acceptable for core :)
Comment #53
snufkin commentedI think we have a fair consensus that we should consider this as a bug, and if so, could we not fix it against 8.0.x? Or the reason to change the version against 8.1.x was to first fix it there and then backport?
Comment #54
mitchalbert commentedpatch #45 works for me and fixes my issue
Comment #55
catchMoving to needs work to remove the configuration option.
@snufkin this could potentially go into 8.0.x if it's ready for the next (last) patch release window for that version.
Comment #56
snufkin commentedI have not been able to reproduce the issue on 8.0.5 and 8.0.x anymore, works as expected. Could someone else confirm?
Comment #57
mtalt commentedI was still experiencing the issue in 8.0.5 and the patch in #45 fixed the issue. I think there is a need for another option to hide the sibling menu items when you drill down further into the menu. Given the following...
Parent1
- Child1.1
-- Grandchild 1.1.1
-- Grandchild 1.1.2
- Child1.2
-- Grandchild 1.2.1
-- Grandchild 1.2.2
- Child1.3
-- Grandchild 1.3.1
-- Grandchild 1.3.2
If I were on the Child 1.1 page, I may only want to display 1.1.1 and 1.1.2. I would want to have the option to hide 1.2 and 1.3
Comment #58
yvesvanlaer commentedI confirm this patch works for one sub level.
It solved my issue at lease but I'm only using 2 levels.
Comment #59
acrosmanI was still seeing problems in 8.0.5 before the patch, which did resolve the issues in my use case. While I understand the need for clear text, functional with slightly wonky interface is better than broken. I suggest this move forward and that a new issue be opened to address the field label.
Comment #60
esolitosI have tested on 8.0.5 and I can still reproduce if i'm not using the patch.
I believe that #57 should be addressed in another issue, although I believe in some occasions it might be useful, it's more an enhancements than a bug.
Comment #61
yoroy commentedExpanding menu trees other than the one the current menu item is in is a bug, not a feature. So yes, lets remove this behaviour.
Comment #62
damienmckenna+1 for fixing the behaviour rather than adding more options that would still leave the broken default behaviour.
Comment #63
kiwad commentedComment #64
kiwad commentedProposition of a re-rolled patch from #45 keeping only the basic fix and leaving all the new "Follow" configuration
Comment #65
kiwad commentedComment #67
kiwad commentedThe patch fails because it introduces a regression (the $tree generated is not the same depth) but that is kind of normal since we are fixing the behaviour. Don't really know how to have a patch that will pass the test without introducing a regression. The "follow" previously added was defaulted to false, so it wasn't introducing a regression, but seems to be consensus that we'd better fix the bug instead of introducing a configuration.
What's the policy for core patch introducing a regression ?
Comment #68
damienmckennaCould it be argued that the testConfigLevelDepth test was wrong in the first place?
The test's menu structure should be like this:
Therefore the test should have checked that if the menu level was set to '2' that only test.example3 or test.example7 would show, whereas the bug indicates that both would be shown.
Back to writing tests.
Comment #69
acrosmanFor what it's worth, the patch in #64 does appear to work properly despite the test failures, so it does look like a problem with the tests requiring an update before this can go in.
Comment #70
awolfey commented#64 is working for me. Thanks.
Comment #71
adrian83 commentedThis is still an issue on 8.2.0. Patch #64 worked for me.
Comment #72
kiwad commentedAdded an issue for the test that need's to be re-written :
#2745003: Rewrite test ConfigLevelDepth
Comment #73
kiwad commentedComment #74
damienmckennaSeeing as a rewritten test would highlight this bug, thus would need to have the bug fixed before the test could be committed, is there any value in having the separate issue for fixing the test?
Comment #75
acrosmanI've updated the patch from #64 to include updates to the tests that review test.example7 from the expected results set. I'm not convinced that this will cover all use cases (e.g. when the block should show text.example7 instead of 3).
Comment #76
acrosmanComment #79
esolitosBoth #75 and #45 patches apply to 8.3.x, however they don't seems to work as they are supposed to.
Comment #80
aaronbaumanCan someone summarize the proposed behavior change / bug fix?
Here is my take, based on discussion and content of these patches:
Is all that correct?
Did I miss anything?
That much makes sense to me, but the patches in this thread have the following additional side effect which does not:For menu items with starting level > 1, do not show any menu when current active menu item level is equal to starting level.
edit: After re-saving the menu items, this issue went away, and most recent patch works as described above.
I'm not sure if this is the "not working" bit that esolitos is referring to.
Comment #81
aaronbaumanComment #82
aaronbaumantest from #77 still failing
Comment #83
acrosmanThe summary in #80 is correct. What's really needed at this point is to get the test fixed so it can get committed.
Comment #84
aaronbaumanOK, updating the issue summary clarified the reason why this test is failing.
For the
$no_active_trail_expectationsportion of this test, the active trail is not set.ie. There's no request context, so no active trail is set.
Since we expect for blocks with level > 1, the menus do not appear at all, we need to adjust the test:
Once that test was fixed, I moved on to
$active_trail_expectations['level_2_and_beyond']which was also failing.2 changes to the previous patches addressed this failure:
array_reversebefore identifying the root:menuTreeParameterwill change the starting level, we also have to adjust the max-depth (if it is set).It feels like this is still missing test coverage, but I can't think of what.
Comment #85
aaronbaumanComment #86
ironsizide commentedI installed a fresh 8.3.x-dev site and applied the path. Added menus, behavior worked as expected. Ran unit tests and they passed locally. Looks good to me.
Comment #87
acrosmanApplies cleanly to 8.2.4 as well. It would be great to get it applied to both.
Comment #88
xjmThanks for testing this patch! We still need to add automated test coverage for the bug, though.
Comment #89
xjmAlso, if we are changing the expectations here from the previous test coverage, we should confirm why it was this way in the first place. A git blame or git log -L on the removed lines in the test could help.
Comment #90
aaronbaumanI included updated tests with the latest patch.
Are you saying those need to be pulled out and posted separately?
Here's where these tests were introduced: #474004: Add options to system menu block so primary and secondary menus can be blocks rather than variables
Maybe someone can scan that thread and recall the conversation to describe the motivation?
Looking at the thread for 5 minutes, I don't see any mention about the specific lines in question.
Comment #91
acrosman@xjm for an explanation of the test issues see comment 68 above. It's been clear from the discussion on this thread that the tests were wrong since before D8 was launched. So the adjustments that aaronbauman made were in keeping with those I attempted a while back and others have been discussing for most of year. Is there something in particular you're looking for to make this fix acceptable?
Comment #92
aaronbaumanStandalone test with line-by-line explanation posted to #2745003: Rewrite test ConfigLevelDepth, fails as expected, not sure what to do next.
Comment #93
damienmckennaI closed the other issue as it was completely redundant, here are the two files uploaded again so you can see how the old corrected test fails and then the patch with the fix. (no code changes, this is exactly the same as #84)
Comment #95
damienmckennaWhoops, accidentally included some local composer changes in drupal-n2631468-93.patch.
Comment #97
damienmckenna(just to be clear, #95 is identical to #84)
Comment #98
Anonymous (not verified) commentedThe patch from #95 works for me very well in Drupal 8.2.4. I have not tested the test part of the patch though.
Comment #99
mrpeanut commentedThe patch from #95 applies to 8.3.x-dev but doesn't seem to be working as expected. I have my initial menu level set to 2. I've tried it with "Expand all menu links" checked and unchecked. In both cases, I still have the original issue.Actually I seem to have another issue, so ignore this post!
Comment #100
AndersNielsen commentedTested #95, fixed the issue for me. Thumbsup (credits #84 for the initial work too!)
Comment #102
stevengfxI was able to reproduce on a fresh install of Drupal 8.2.6.
Menu displayed:
Comment #103
stevengfxApplied patch in #95. Menu displays correctly.
Comment #104
Ky1eT commentedComment #105
xjmThanks @StevenGFX for the manual testing, and @aaronbauman and @DamienMcKenna for investigating the needed test change.
My feedback in #89 is partly but not quite wholly addressed. It's clear from #68 and the test-only patch @DamienMcKenna provided in #93 that these changes are needed for compatibility with the new approach. However, it's still not clear why the test was asserting this apparently bugged behavior in the first place.
@aaronbauman traced it to #474004: Add options to system menu block so primary and secondary menus can be blocks rather than variables above. So all I think the last thing we need to do to cover my question in #89 is to have one other person go over that issue and confirm that it wasn't intentionally set that way. Someone might need to poke around a bit on the interdiffs and old patches on the issue to figure out exactly what the reasoning was for adding it (or if there was none and it dated to the first draft of the patch with no explanation, etc.). That should cover it I think.
Finally though, I think we still do also need new tests asserting the new behavior explicitly as per #88. #102 actually looks like a good scenario to translate into an additional automated test, perhaps.
Thanks everyone! I think this is close.
Comment #106
damienmckennaThanks for the continued work, everyone, and to xjm for the direction. If nobody gets to it first, I'll try to look into this one during the week.
Comment #107
aaronbaumanOK, I think I've untangled this.
Spoiler alert:
There were (at least) 2 different threads going in parallel which resulted in this behavior getting into core, along with tests to pass it, #1869476 and #474004 respectively.
I'm working on typing up a fully annotated timeline now.
Comment #108
aaronbaumanThe test change relates to what I'll call the "sibling-trail" bug, laid out in detail on this thread. (To recap the bug: for menu blocks with starting depth level 2+, it doesn't make sense to show expanded links outside of the active menu trail.)
Here's the history I pieced together of how this behavior came to be:
Roll back to the stone ages of Menu Block module - the inspiration for the "starting level" feature - and there has never been a "sibling-trail" bug. (JohnAlbin may wish to confirm or deny this statement.) Either because of the additional configuration options offered by Menu Block, or because of explicit accommodation, Menu Block's behavior works off the shelf as expected in this thread.
For Drupal core, roll back to January 2013, and in 1869476-19 -- converting menus to blocks -- Sun makes many of the points repeated in this thread and in 474004, especially (emphasis mine):
This position is echoed by kim.pepper in 474004-70:
and Crell in 474004-71:
The meat of the sibling-trail bug is introduced around 474004-143:
- Wim Leers suggests that we don't want to support "the expanded option behavior", but doesn't mention how that will effect menu behavior outside of core's special primary/secondary menus.
Then, in 474004-144, kim.pepper attempts to clarify, and suggests adhering to the help text: "Blocks that start with the 2nd level or deeper will only be visible when the trail to the active menu passes through the block’s starting level.'"
Then in 474004-145, Wim Leers dismisses this concern, and advocates dropping support for this behavior, because core's primary/secondary menus won't be affected. Wim Leers provides screenshots to illustrate this position, but does not provide examples with enough depth to surface the sibling-trail bug.
Wim Leers also suggests twice in this thread that pwolanin would agree with this decision, but neither pwolanin nor crell re-join the discussion after #70.
Sun commented again in 474004-181, but does not weigh in on the sibling-trail bug.
Bojhan and yoroy weigh in with usability concerns in 474004-183 and 474004-188, but only from the perspective of admins - not from the perspective of the user-facing menu block or the sibling-trail bug.
For me this is the key takeaway:
It's apparent from the discussion in 474004 that the change arounded "expanded" behavior is discussed at some length, but not in relation to the sibling-trail bug. Further, the original issue description has not been updated with any illustration of the user-facing changes. The various descriptions in comments on the thread do not address the sibling-trail bug at all, even though the behavior is covered by its tests.
Probably useful at this point to have someone from #474004 weigh in on this assessment, because i'm way too far down the rabbit hole now.
Comment #109
damienmckenna@aaronbauman: Huge thanks for digging through all of that!
IMHO it seems like the original feature request was slightly derailed, that the tests were not specific enough to clarify the exact intent and then a very limited use case was considered for the functionality with other use cases (thus an aspect of the agreed functionality) dismissed.
Comment #110
eigentor commentedPatch #95 worked for me, too. (8.2.4)
Comment #111
simon georges commentedPatch #95 worked for me (and a colleague on a different instance) on Drupal 8.3.1 vanilla standard install, but there is a strange side-effect: on pages with no sub-menu, the region which the block is in is displayed, but empty (so the page.region is not empty, but the render() doesn't generate any HTML, thus the empty region).
A {{ dump(page.region) }} does indeed contain an array of the menu block, but the render array only contains #cache, #weight, #lazy_builder and #theme_wrappers keys. Hope that helps.
(Note: the "monstruosity" {% if page.region|render|trim is not empty %} did the trick...)
Comment #112
sascher commentedI'm sitting here with @lokapujya at Druplacon baltimore running 8.3.1 and it looks fixed to us on my machine without the patch
Comment #113
lokapujyaThe "observed behavior" in the issue summary doesn't seem to be the case. What I see when on the "About Event 1" page is:
-- Event 1
--- About Event 1
--- Subscribe to Event 1
-- Event 2
After reading ALL the comments, see comment #80 for a description of the latest patches proposed changes. It proposes to repurpose "show as expanded". Why would we do that? If you don't want it to be expanded, then just don't check it off.
It also removes the ability to see all the items at the current level. What if you have a menu, and you DO want to see the all the items at the current level of the menu?
Comment #114
aaronbaumanSounds like you don't have the "show as expanded" property set.
There are 2 different use-cases identified for the "show as expanded" checkbox:
1. For an entire menu tree, always show all of the links for all branches
2. For a given menu sub-tree, always show all of the child links in the tree
The most recent patch supports these 2 use cases, while eliminating the behavior of showing sibling-level menu items from separate sub-trees for level 2+ menu items.
If you want to create a menu which shows all top-level siblings, that behavior is preserved. In that case, the "Expand" checkbox will continue to show all children of those branches as desired.
For level-2+ items, it's the general consensus on this and other threads that this use case simply doesn't make sense.
In any hierarchical structure, the top-level items provide integral context.
It's not a plausible use case that someone would want to see *all* level-2 items across *all* sub-trees, without the context of their top-level parents.
Please review the discussion and links to bug reports for users encountering this behavior.
Comment #115
aaronbaumanI am in the sprint room and it's definitely not fixed on 8.4.x
Comment #116
aaronbaumanre @simon in #111:
I can't reproduce this empty-block behavior locally.
Are you sure this behavior is a side effect of the patch?
Can you explain the steps to reproduce?
Comment #117
aaronbaumanComment #118
acrosmanre bug raised in #111, I can reproduce, but it's not from this patch (I can reproduce without it as well). That was reported in #2642816: Menu block is never empty, region keeps showing up.
I'll list the reproduction steps here in case anyone wants to validate this, but I think it's a separate issue:
Again, this happens with or without the patch from #95, which is the same as the patch from #84.
Since that is a separate issue, and this patch does not impact it for better or worse, I'm setting this issue back to RBTC.
Comment #119
simon georges commentedThanks for the feedback, @acrosman, and for pointing out the other issue.
Comment #120
catch@aaronbauman's description of how the bug was introduced is fantastic.
However I don't think that xjm's other point in #105 has been addressed:
So CNW for adding more specific test coverage for the behaviour we want.
Comment #121
aaronbaumanComment #122
yogeshmpawarRe-roll the #95 patch because it's failed to apply on 8.4.x branch.
Comment #123
aaronbaumanRight, thanks for calling out that detail. The existing test scenarios already include a minimal menu hierarchy to elicit this behavior, and the proposed change updates test assertions to provide explicit coverage.
To address #102 specifically, StevenGFX's scenario includes more menu items to produce a similar behavior.
But, we can already observe the behavior with the existing scenario.
Therefore, we don't need to change the existing scenario, we need only change our assertions.
Again, to summarize briefly:
Scenarios / Givens:
NB: This is the existing scenario; proposed change in this thread doesn't touch this at all.
item 3OR no active menu item at allObserved behavior:
item 7.item 7should be displayed.Expected behavior / proposed change:
item 7item 7should not be displayedComment #124
aaronbaumanComment #125
acrosmanI think we are back to RTBC. As @aaronbauman points out the tests as written in the current patch cover the scenarios.
Comment #126
catchHm OK the fails in #93 and explanation in #123 look reasonable to me.
Fixed this on commit:
Committed/pushed to 8.4.x, thanks!
Comment #128
adrian83 commentedHurray! Thank you, everyone!
Comment #129
esolitosWow! Glad to see that we made it by 8.4.x! :)
Good job everyone!
Comment #130
acrosmanI'm thrilled to see this is finally in. Is it reasonable to get this into one of the 8.3 releases that may still come along before 8.4 is released?
At last check (the security update the other day) the patch applied to 8.3 as well.
Comment #132
fkelly12054@gmail.com commentedComment #133
fkelly12054@gmail.com commentedSorry, I was reading this thread, with no intention of commenting when Firefox hung up. When I restored my Drupal.org session this was posted. I see no way to delete it and suspect that deleting even inadvertent posts is not wanted. Sorry again.
Comment #134
acrosmanMoving back to 8.4 and Bug just for record keeping. No worries @fkelly, the machines get the best of all of us from time to time.
Comment #135
fkelly12054@gmail.com commentedI think that a patch to Superfish may be required if you want to fit this into 8.3.
https://www.drupal.org/node/2896583
before it can run with the updated SystemMenuBlock.php from the 8.4 commit. So, if this update is applied to 8.3 someone should look at coordinating that update with Superfish. (On my local test system I'm experimenting with Superfish as a means to get drop down hierarchical menus working and driving myself buggy with the way expanded menu items work (or don't)). I tried the 8.4. SystemMenuBlock.php on my 8.3 system and it caused the error reported in the link above. Restored the old SystemMenuBlock.php for now.