History

When navigating to a fragment inside a `<details>`, open it…

…this matches browsers' native behaviour.

Calum Smith committed 1 year ago

Commit d6f16be1 parent dd2c3e52 files · +11 −0Browse files

Showing the changes to assets/javascripts/lib (1 of 2 files). Show all

Unified · Split

assets/javascripts/lib/util.js+10−0
@@ -353,6 +353,16 @@ $.lockScroll = function (el, fn) { · 352 unmodified lines
353353 }
354354 };
355355
356+// If `el` is inside any `<details>` elements, expand them.
357+$.openDetailsAncestors = function (el) {
358+ while (el) {
359+ if (el.tagName === "DETAILS") {
360+ el.open = true;
361+ }
362+ el = el.parentElement;
363+ }
364+}
365+
356366 let smoothScroll =
357367 (smoothStart =
358368 smoothEnd =