Commit 8d211be
authored
Fix/7579 toc scroll console error (#12433)
### Related Ticket(s)
https://jsw.ibm.com/browse/ADCMS-8128
### Description
The calculation that the ToC component does to map all the sections of the page and link them to the ToC's buttons was also being called on pages without the ToC enabled. That was causing the property 'position' to be undefined due to ToC trying to compute multiple items but only finding one, resulting in multiple of these errors in the console:
<img width="528" height="64" alt="image" src="https://github.com/user-attachments/assets/82391ea4-ea2e-45e2-8f9a-e0cce3133217" />
### Changelog
- packages/web-components/src/components/table-of-contents/table-of-contents.ts
added some conditions to validate if there are enough elements to trigger the calculations.1 parent 05104b7 commit 8d211be
File tree
1 file changed
+14
-6
lines changed- packages/web-components/src/components/table-of-contents
1 file changed
+14
-6
lines changedLines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
| |||
0 commit comments