0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/plugins/spoiler-alert/test/javascripts
Bannon Tanner 65d162b350
FIX: Allow re-blur on spoiler when in details view (#41266)
`INTERACTIVE_SELECTOR` includes "details" so that clicking a `<details>`
inside a spoiler expands it without also re-blurring the surrounding
spoiler. But because `closest()` walks up the DOM tree, every click
inside a `[spoiler]` that happens to be nested inside a `[details]` also
matches `closest("details")` against the parent `<details>` — making
such a spoiler impossible to re-blur once revealed.

Fix: scope the `closest()` result with `element.contains(...)` so only
interactive ancestors that live inside the spoiler block re-blurring.
Interactive ancestors above the spoiler are ignored.

Tests cover both directions: a spoiler-inside-details can re-blur, and
clicking an interactive descendant of a revealed spoiler still does not
re-blur it.

Context:
https://meta.discourse.org/t/spoilers-don-t-toggle-when-inside-details/194499
2026-06-29 12:47:49 -05:00
..
acceptance DEV: Replace toolbar popup menu with DMenu (#33247) 2025-07-03 09:57:16 +10:00
integration UX: improvements to rich editor spoiler (#34149) 2025-08-21 13:56:31 -03:00
unit/lib FIX: Allow re-blur on spoiler when in details view (#41266) 2026-06-29 12:47:49 -05:00