Skip to content

Commit 7b43a8d

Browse files
committed
details["open"]
1 parent 598ebed commit 7b43a8d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/pydata_sphinx_theme/toctree.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,8 @@ def generate_toctree_html(
273273

274274
# Open the sidebar navigation to the proper depth
275275
for ii in range(int(show_nav_level)):
276-
for checkbox in soup.select(
277-
f"li.toctree-l{ii} > input.toctree-checkbox"
278-
):
279-
checkbox.attrs["checked"] = None
276+
for details in soup.select(f"li.toctree-l{ii} > details"):
277+
details["open"] = None
280278

281279
return soup
282280

@@ -363,7 +361,7 @@ def add_collapse_checkboxes(soup: BeautifulSoup) -> None:
363361
if "current" in classes:
364362
parentli = element.find_parent("li", class_="toctree-l0")
365363
if parentli:
366-
parentli.find("details")["open"] = True
364+
parentli.find("details")["open"] = None
367365

368366
# Nothing more to do, unless this has "children"
369367
subtree = element.find("ul")
@@ -411,7 +409,7 @@ def add_collapse_checkboxes(soup: BeautifulSoup) -> None:
411409
# If this has a "current" class, be expanded by default
412410
# (by opening the details/summary disclosure widget)
413411
if "current" in classes:
414-
details["open"] = True
412+
details["open"] = None
415413

416414

417415
def get_local_toctree_for(

0 commit comments

Comments
 (0)