[3.0] Label a spoiler that was given no summary of its own - #9420
Merged
Sesquipedalian merged 2 commits intoAug 30, 2026
Merged
Conversation
Neither fallback worked. One asked for summary_default, which no language file defines, so getTxt() returned an empty string. The other used ?? against a parameter the parser fills in as '' rather than leaving unset, so it never reached its fallback either. Both draw an empty summary, which is a details element with nothing to click. Use the editortxt string the details tag already falls back to, name the file it lives in, and test the parameter with ?: so an empty one counts. Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sesquipedalian
approved these changes
Aug 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A spoiler with no summary of its own renders
<summary class="bbc_summary"></summary>— a details element with nothing in the part you are meant to click.There are two fallbacks and neither works.
Spoiler2(the[spoiler="…"]form) asks for a string that does not exist:No language file defines
summary_default, andLang::getTxt()returns''for a key it cannot find, so nothing is logged and nothing is drawn.Spoiler1(the[spoiler]form, which becomes a details element when the content has more than one paragraph) has the right key but the wrong test:The parser fills every optional parameter in, as an empty string rather than leaving it unset, so
??never falls back. Dumping$paramsfor a plain[spoiler]:The branch is only entered when
!empty($params['{text}'])is false or the content has paragraphs, so in the paragraph case{text}is known to be empty by the time??is asked — it could never have fired.Details::validate()a few files over gets both parts right, and its$editortxt['details']is the model for this, so$editortxt['spoiler']is what I used rather than adding asummary_defaultstring.I also named the language file on both calls.
Editor.phphappens to be loaded on a topic view already, so this is not what was breaking them, but neither call said where its string lives.Verified on a local 3.0 install, three posts:
[spoiler=""]hidden[/spoiler]<summary class="bbc_summary"></summary><summary class="bbc_summary">Spoiler</summary>[spoiler]with two paragraphs<summary class="bbc_summary"></summary><summary class="bbc_summary">Spoiler</summary>[details]plain[/details]<summary class="bbc_summary">Details</summary>One thing I noticed while testing and did not touch: a multi-paragraph
[spoiler]leaves its closing tag in the output as literal text (second paragraph[/spoiler]) while still emitting</div></details>at the end. That happens onrelease-3.0too and is unrelated to the label — filed separately as #9421.Issues References (Fixes|Related|Closes)
Related: #9421