Problem/Motivation
The mobile version of the Table of Contents appears on the Desktop version of pages and Desktop version appears on mobile
Steps to reproduce
Install version 2.0.1. of TOC API and go to a page in screen size larger than 768px and one that utilizes the TOC feature. It shows the Desktop version of the TOC and the mobile dropdown right underneath. Going to the mobile version of the page will show both TOCs as well.
Proposed resolution
Not totally sure. I rolled my version back to 2.0.0. and its working correctly. It seems like something isn't picking up the responsive styles correctly and leaving them off the page.
Remaining tasks
User interface changes
API changes
Data model changes
Drupal Version: 10.5.4
Let me know if there is anything else I can be of assistance with. Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| Screenshot 2025-10-22 at 11.31.16 AM.png | 33.97 KB | thanksneco | |
| Screenshot 2025-10-22 at 11.27.01 AM.png | 38.72 KB | thanksneco |
Issue fork toc_api-3553887
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
thanksneco commentedComment #3
revija commentedHello, this error occurs when the toc_api module makes three calls to renderRoot() within a render flow, which is no longer valid in Drupal 10.2+.
This breaks the render context and causes the error:
A stray renderRoot() invocation is causing bubbling of attached assets to break.
Affected file: web/modules/contrib/toc_api/src/TocBuilder.php
Edit the file, then clear the caches and let us know.
Comment #4
jurgenhaasI ran into this as well, not related to mobile or desktop, though. I just figured that no libraries get called anymore. And when I revert that change from
rendertorenderRoot, then the problem is fixed. This was introduced in #2905420: Fix empty render context but that doesn't seem to be the correct solution. I'm creating an MR to revert this.Comment #6
jurgenhaasNot sure what the fix for the other issue is, but for now I needed to revert the change to that libraries get loaded again.
Comment #7
seattlehimay commentedThank you for posting Jugenhaas!
I was seeing my default TOCs change to numbered lists with a strange pull down menu.
I manually applied your reversion, and it fixed the issues I was seeing on D10.5.4/TOC-API 2.0.1/TOC Filter 8.x-2.4. Back to a normal TOC.
Comment #8
joelpittetYes this works to get the library to load. Thank you all!
Comment #9
papagrandeI was getting fatal errors on views RSS feeds. The reversion fixed it for me. Thanks, @jurgenhaas.
Comment #11
joseph.olstadComment #13
joelpittetThank you! One less patch woo!
Comment #14
joelpittetThis would be a good to drop a release as it’s a major fix
Comment #15
joseph.olstadFYI: I've tagged this and put it into an RC1 release
2.0.2-rc1
https://www.drupal.org/project/toc_api/releases/2.0.2-rc1
Feedback is appreciated!
Comment #16
joseph.olstadLooked at the usage stats, decided to tag 2.0.2 now, thanks!
https://www.drupal.org/project/toc_api/releases/2.0.2
Comment #17
ericgsmith commentedThanks Joseph, much appreciated