Skip to content

Commit

Permalink
Ensure sidebar formatting only occurs within Sidebar div
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriedy committed Apr 19, 2023
1 parent 93aab89 commit 8dc9caf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/st_pages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def _get_indentation_code() -> str:
for idx, val in enumerate(current_pages.values()):
if val.get("is_section"):
styling += f"""
li:nth-child({idx + 1}) a {{
div[data-testid=\"stSidebarNav\"] li:nth-child({idx + 1}) a {{
pointer-events: none; /* Disable clicking on section header */
}}
"""
Expand All @@ -308,7 +308,7 @@ def _get_indentation_code() -> str:
elif is_indented:
# Unless specifically unnested, indent all pages that aren't section headers
styling += f"""
li:nth-child({idx + 1}) span:nth-child(1) {{
div[data-testid=\"stSidebarNav\"] li:nth-child({idx + 1}) span:nth-child(1) {{
margin-left: 1.5rem;
}}
"""
Expand Down Expand Up @@ -361,7 +361,7 @@ def _get_page_hiding_code(pages_to_hide: list[str]) -> str:
section_hidden = False
if page_name in pages_to_hide or section_hidden:
styling += f"""
li:nth-child({idx + 1}) {{
div[data-testid=\"stSidebarNav\"] li:nth-child({idx + 1}) {{
display: none;
}}
"""
Expand Down

0 comments on commit 8dc9caf

Please sign in to comment.