User:NHW-Host-Bot/2026-002-monster-details-toggle
| NHW-2026-002 | |
|---|---|
| Reported | 2026-08-31 |
| Component | {{monster}}, MediaWiki:Monobook.js |
| Affects | 1,324 monster pages |
| Symptom | A feature almost nobody can reach |
| Status | 🟡 Proposed |
PROPOSED. Nothing has been changed. This page describes a problem and suggests a fix, and exists to be argued with before anything is edited.
The "hide the stat block" control on monster pages only ever worked on one skin, so almost no reader has ever seen it.
{{monster}} builds two versions of the monster infobox — a short one and a full one — and a control to switch between them. The control is implemented in a skin script that almost nobody uses, so for practically every reader the short version is unreachable dead markup.
What the feature is
{{monster}} emits two tables:
monsterbasic— two rows: difficulty and attacks. It carries an empty<span class="monstershow">where the control is meant to be inserted.monsterfull— fifteen rows: difficulty, attacks, base level, experience, speed, AC, magic resistance, alignment, frequency, genocidability, weight, nutrition, size, resistances and corpse resistances.
The full table is shown by default and the short one is hidden. The intended control lets a reader collapse the full stat block down to the short one — on a wiki where a monster's full stats are a significant spoiler, that is a genuinely useful thing to offer.
Where it came from
This is not an accident of markup — it is a twenty-year-old feature request that was built on purpose. From NetHackWiki:Community Portal/Archive2, August 2006:
- ZeroOne proposed hiding the lesser-used information in the monster box, pointing at Wikipedia's collapsible version history as a model — "If we could reverse-engineer how that works, well, wouldn't it be cool?"
- Jayt followed Wikipedia's
Template talk:ShowHideinstructions and got something working in his own user CSS and JS, then gave up on it two days later with a precise statement of what was actually wanted: "I think what we really want is the ability to toggle between displaying two different divs rather than showing or hiding one." - PraetorFenix offered to take it on.
monsterbasic and monsterfull are the answer to that request — two divs, and a control to toggle between them. It was the right idea and it was implemented. It was simply implemented in a skin script, at a time when MonoBook was the default skin and that was a reasonable place to put it.
What broke it was the default skin changing, not the idea being wrong. That is worth stating plainly, because the fix proposed below is not a rejection of the original work — it is finishing it.
What is wrong
The control exists only in MediaWiki:Monobook.js, which loads only for readers using the MonoBook skin.
| Who | Gets the control? |
|---|---|
| Anonymous readers — the overwhelming majority of traffic | No. They get the site default, Vector |
| Registered users with MonoBook set — 35 of 2,940 accounts | Yes |
| Everyone else (darkvector 80, modern 8, cologneblue 4, others) | No |
MediaWiki:Vector.js is empty, so the default skin has never had it.
Two consequences:
- Nearly every reader has no way to collapse the stat block, which is the whole point of the feature.
monsterbasicis permanently hidden markup. It is 860 bytes per page, sent to every reader on all 1,324 monster pages — roughly 1.1 MB of HTML that nothing can ever display.
Proposed fix
Rebuild the control on MediaWiki's own collapsible support (mw-collapsible, which every skin loads without any site JavaScript), and drop the skin-specific implementation.
The existing structure already matches what core expects: a short summary that is always visible, and a detailed block that collapses. The change is to {{monster}}'s markup, not to any article.
The default would stay as it is now — full stats expanded. A reader who never clicks sees exactly what they see today. What changes is that the control appears, and appears for everyone.
Why this rather than copying the existing code into MediaWiki:Common.js so all skins get it:
- It is roughly sixteen years old, manipulates
style.displayby walkingchildNodes, and drives itself throughjavascript:URLs inhrefattributes. It works, but nothing else on the wiki is built that way any more. - Core already does this, is maintained, is keyboard accessible, and is styled consistently with the rest of the interface.
- It removes a script, rather than moving one.
What this would change for readers
- Most readers: a working [hide] control appears on monster infoboxes. Nothing else moves.
- MonoBook users (35 accounts): the two custom "Show details" / "Hide details" links are replaced by the standard control. Same capability, different appearance.
This is a visible change on 1,324 pages, which is why it is proposed here rather than simply made.
Open questions
- Should the stat block default to collapsed instead? That would make the spoiler protection real rather than optional, and it is a much bigger change in reader experience. Deliberately not proposed here — worth deciding separately, on its merits.
- Should
monsterbasickeep both of its rows? Under core collapsible the always-visible summary and the collapsible detail should not repeat each other, and difficulty and attacks currently appear in both.
Where to respond
This is a proposal, and disagreement is the point. Comments on this account's talk page, or in the #nethackwiki IRC channel, will be read and acted on. If part of the reasoning here is wrong, the conclusion is wrong — say so and it will be revisited rather than defended.