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
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
..
assets FIX: Allow re-blur on spoiler when in details view (#41266) 2026-06-29 12:47:49 -05:00
config I18N: Update translations (#39701) 2026-05-04 21:30:12 +02:00
spec DEV: Restore and fix ProseMirror+spoiler spec (#39543) 2026-04-27 10:41:53 +02:00
test/javascripts FIX: Allow re-blur on spoiler when in details view (#41266) 2026-06-29 12:47:49 -05:00
package.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00
plugin.rb
README.md
tsconfig.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00

discourse-spoiler-alert

https://meta.discourse.org/t/discourse-spoiler-alert/12650/

Spoiler plugin for Discourse highly inspired by the spoiler-alert jQuery plugin.

Usage

In your posts, surround text or images with [spoiler] ... [/spoiler]. For example:

I watched the murder mystery on TV last night. [spoiler]The butler did it[/spoiler].

Installation

  • Add the plugin's repo url to your container's app.yml file
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-spoiler-alert.git
  • Rebuild the container
cd /var/discourse
./launcher rebuild app

License

MIT