Skip to content

Commit 0023a70

Browse files
authored
Fix selector for admonition title in togglebutton.js (#77)
* Fix selector for admonition title in togglebutton.js When the toggleID contains symbols such as `:` an error occurs in JS and all dropdown admonitions after the current element stop functioning. The `CSS.escape` call fixes this. * Add 0.4.5 changelog entry Add CHANGELOG entry for 0.4.5 (2026-03-27) noting a fix: corrected the selector for the admonition title in togglebutton.js.
1 parent ec20337 commit 0023a70

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.4.5 - 2026-03-27
4+
5+
### Fixed
6+
7+
- Fix selector for admonition title in togglebutton.js.
8+
39
## 0.4.4 - 2026-01-14
410

511
### Fixed

sphinx_togglebutton/_static/togglebutton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var initToggleItems = () => {
5050

5151
// Add click handlers for the button + admonition title (if admonition)
5252
admonitionTitle = document.querySelector(
53-
`#${toggleID} > .admonition-title`
53+
`#` + CSS.escape(toggleID) + ` > .admonition-title`
5454
);
5555
if (admonitionTitle) {
5656
// If an admonition, then make the whole title block clickable

0 commit comments

Comments
 (0)