diff --git a/README.md b/README.md
index e8fc0a01..d68f9c32 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,7 @@ reference in **[docs/API.md](docs/API.md)**.
| [Expansion](docs/API.md#expansion) | `ClassicExpansionAtLeast`, `ClassicExpansionAtMost`, `GetClassicExpansionLevel` |
| [Faction](docs/API.md#faction) | `C_Reputation.GetFactionDataByID`, `C_Reputation.GetFactionDataByIndex`, `C_Reputation.GetFactionStandings`, `C_Reputation.GetLastStandingChange`, `C_Reputation.GetWatchedFactionData`, `C_Reputation.IsFactionActive`, `C_Reputation.IsFactionActiveByID`, `C_Reputation.IsFactionInactive`, `C_Reputation.SetFactionActive`, `C_Reputation.SetFactionActiveByID`, `C_Reputation.SetFactionInactive`, `C_Reputation.SetFactionInactiveByID`, `C_Reputation.SetSelectedFaction`, `C_Reputation.SetSelectedFactionByID`, `C_Reputation.SetWatchedFactionByID`, `C_Reputation.ToggleFactionAtWar`, `C_Reputation.ToggleFactionAtWarByID`, `GetFactionIDByIndex`, `GetFactionInfoByID`, `GetFactionParentID` |
| [Focus](docs/API.md#focus) | `ClearFocus`, `FocusUnit` |
-| [Frame](docs/API.md#frame) | `region:SetPoint("point")` (one-arg form), `region:SetSize`, `region:GetSize`, `region:IsMouseOver`, `region:GetRect`, `region:IsDragging`, `GetMouseFoci`, `frame:SetShown`, `fontstring:GetStringHeight`, `fontstring:GetUnboundedStringWidth`, `fontstring:GetWrappedWidth`, `fontstring:GetNumLines`, `fontstring:GetLineHeight`, `fontstring:IsTruncated`, `fontstring:SetMaxLines`, `fontstring:GetMaxLines`, `fontstring:SetFormattedText`, `texture:SetRotation`, `texture:GetRotation`, `texture:SetVertexOffset`, `texture:GetVertexOffset`, `texture:SetColorTexture`, `texture:SetAtlas`, `texture:GetAtlas`, `texture:ResetTexCoord`, `texture:SetSpriteSheetCell`, `texture:SetDesaturation`, `texture:GetDesaturation`, `texture:SetMask`, `frame:CreateMaskTexture`, `texture:AddMaskTexture`, `texture:RemoveMaskTexture`, `texture:GetNumMaskTextures`, `texture:GetMaskTexture`, `fontstring:SetRotation`, `fontstring:GetRotation`, `editBox:SetCursorPosition`, `editBox:GetCursorPosition`, `editBox:GetUTF8CursorPosition`, `editBox:ClearHighlightText`, `editBox:HasFocus`, `editBox:HasText`, `editBox:SetHighlightColor`, `editBox:GetHighlightColor`, `editBox:ClearHistory`, `frame:SetResizeBounds`, `frame:HookScript`, `frame:IsEventRegistered`, `frame:RegisterUnitEvent`, `frame:GetEffectiveAlpha`, `frame:SetAttribute`, `frame:SetAttributeNoHandler`, `frame:ClearAttribute`, `frame:GetAttribute`, `OnAttributeChanged` (script), `SetModernScriptArgs`, `GetModernScriptArgs`, `PreClick` (script), `PostClick` (script), `GetClickFrame` |
+| [Frame](docs/API.md#frame) | `region:SetPoint("point")` (one-arg form), `region:SetSize`, `region:GetSize`, `region:IsMouseOver`, `region:GetRect`, `region:IsDragging`, `GetMouseFoci`, `frame:SetShown`, `fontstring:GetStringHeight`, `fontstring:GetUnboundedStringWidth`, `fontstring:GetWrappedWidth`, `fontstring:GetNumLines`, `fontstring:GetLineHeight`, `fontstring:IsTruncated`, `fontstring:SetMaxLines`, `fontstring:GetMaxLines`, `fontstring:SetFormattedText`, `texture:SetRotation`, `texture:GetRotation`, `texture:SetVertexOffset`, `texture:GetVertexOffset`, `texture:SetColorTexture`, `texture:SetAtlas`, `texture:GetAtlas`, `texture:ResetTexCoord`, `texture:SetSpriteSheetCell`, `texture:SetDesaturation`, `texture:GetDesaturation`, `texture:SetMask`, `frame:CreateMaskTexture`, `texture:AddMaskTexture`, `texture:RemoveMaskTexture`, `texture:GetNumMaskTextures`, `texture:GetMaskTexture`, `fontstring:SetRotation`, `fontstring:GetRotation`, `editBox:SetCursorPosition`, `editBox:GetCursorPosition`, `editBox:GetUTF8CursorPosition`, `editBox:ClearHighlightText`, `editBox:HasFocus`, `editBox:HasText`, `editBox:SetHighlightColor`, `editBox:GetHighlightColor`, `editBox:ClearHistory`, `frame:SetResizeBounds`, `frame:HookScript`, `frame:IsEventRegistered`, `frame:RegisterUnitEvent`, `frame:GetEffectiveAlpha`, `frame:SetAttribute`, `frame:SetAttributeNoHandler`, `frame:ClearAttribute`, `frame:GetAttribute`, `OnAttributeChanged` (script), `SetModernScriptArgs`, `GetModernScriptArgs`, `PreClick` (script), `PostClick` (script), `button:RegisterForClicks("AnyUp"/"AnyDown")`, `GetClickFrame` |
| [FriendList](docs/API.md#friendlist) | `C_FriendList.GetFriendInfo`, `C_FriendList.GetFriendInfoByIndex`, `C_FriendList.GetNumFriends`, `C_FriendList.GetNumOnlineFriends`, `C_FriendList.GetNumWhoResults`, `C_FriendList.GetWhoInfo`, `C_FriendList.IsFriend`, `C_FriendList.IsIgnored`, `C_FriendList.IsIgnoredByGuid`, `C_FriendList.IsWhoQueryPending`, `C_FriendList.SendWhoQueryByName`, `C_FriendList.SetFriendNotes`, `C_FriendList.SetFriendNotesByIndex` |
| [GameObject](docs/API.md#gameobject) | `C_GameObjectInfo.GetGameObjectInfoByID`, `C_GameObjectInfo.RequestLoadGameObjectByID`, `ClosestGameObjectPosition` |
| [Glue](docs/API.md#glue) | `C_Glue.IsOnGlueScreen` |
diff --git a/docs/API.md b/docs/API.md
index 898f02bb..92c60865 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -265,6 +265,7 @@ build instructions.
- [`RegisterUnitWatch` / `UnregisterUnitWatch` / `UnitWatchRegistered`](#registerunitwatch--unregisterunitwatch--unitwatchregistered)
- [`SecureButton_GetAttribute` / `SecureButton_GetUnit`](#securebutton_getattribute--securebutton_getunit)
- [`PreClick` / `PostClick` button scripts](#preclick--postclick-button-scripts)
+ - [`Button:RegisterForClicks("AnyUp" | "AnyDown" | ...)`](#buttonregisterforclicksanyup--anydown--)
- [`GetClickFrame(name)`](#getclickframename)
- [FriendList](#friendlist)
@@ -6358,6 +6359,30 @@ btn:SetScript("OnClick", function() print("the click") end)
btn:SetScript("PostClick", function(self, button) print("after the click:", button) end)
```
+### `Button:RegisterForClicks("AnyUp" | "AnyDown" | ...)`
+
+`RegisterForClicks` accepts two collective names:
+
+- `"AnyUp"` — the button responds to the release of every mouse button.
+- `"AnyDown"` — the button responds to the press of every mouse button.
+
+`"AnyUp"` stands for the five `*Up` names and `"AnyDown"` for the five
+`*Down` names. You can mix them with the explicit names.
+
+```lua
+btn:RegisterForClicks("AnyUp")
+btn:RegisterForClicks("AnyDown", "LeftButtonUp")
+```
+
+The explicit names are `LeftButtonUp`, `LeftButtonDown`, `RightButtonUp`,
+`RightButtonDown`, `MiddleButtonUp`, `MiddleButtonDown`, `Button4Up`,
+`Button4Down`, `Button5Up`, and `Button5Down`. Names are not case-sensitive.
+
+A name that is not in this list counts as no click type. A call with only
+unknown names makes the button respond to no click at all. `Button:Click()`
+ignores the click types, so a button in that state still responds to
+`Click()`.
+
### `GetClickFrame(name)`
Returns the frame with the given global name. The `/click` command uses it to
diff --git a/src/Offsets.h b/src/Offsets.h
index 2b441764..97a05665 100644
--- a/src/Offsets.h
+++ b/src/Offsets.h
@@ -2325,6 +2325,30 @@ enum Offsets {
VAR_FRAME_METHOD_REGISTRY = 0x00CF4D38,
VAR_TEXTURE_METHOD_REGISTRY = 0x00CF5434,
VAR_FONTSTRING_METHOD_REGISTRY = 0x00CF5400,
+ // Button — 39 methods (table 0x00879D00), ctx per docs/raw_methods.txt.
+ // CheckButton inherits it through the dispatcher's type walk. `Frame::
+ // ClickMask` re-registers `RegisterForClicks` here (most recent
+ // registration wins — the Texture::Desaturation mechanism) to add AnyUp /
+ // AnyDown in front of the engine's entry.
+ VAR_BUTTON_METHOD_REGISTRY = 0x00CF4E14,
+ // The engine's `Button:RegisterForClicks(...)` (Button table entry 35) —
+ // standard `int __fastcall(void *L)`. Loops `lua_isstring(L, i)` from
+ // index 2 until the first non-string, SStrCmpI's each against exactly ten
+ // literals (LeftButtonDown 0x1 / LeftButtonUp 0x100, Middle 0x2 / 0x200,
+ // Right 0x4 / 0x400, Button4 0x8 / 0x800, Button5 0x10 / 0x1000 — low
+ // byte = press, high byte = release), an unknown name contributing 0, and
+ // ASSIGNS the OR to button+0x330 via FUN_BUTTON_SET_CLICK_MASK. So a call
+ // with only unknown names (e.g. the modern "AnyUp") zeroes the mask and
+ // the button stops responding to every real click, silently — Button:Click
+ // ignores the mask, so programmatic clicks still work and hide it.
+ // `Frame::ClickMask` appends the five expansions of AnyUp / AnyDown to the
+ // Lua stack and tail-calls this, so the engine's parser, setter and error
+ // text stay in force.
+ FUN_SCRIPT_BUTTON_REGISTERFORCLICKS = 0x00782490,
+ // Button::SetClickMask — __thiscall(button, mask): writes +0x330. The
+ // ctors call it with the type default (Button 0x100 = LeftButtonUp;
+ // hyperlink button 0x500). Reference only.
+ FUN_BUTTON_SET_CLICK_MASK = 0x00779730,
// EditBox — 48 methods (table 0x0087BB68), ctx per
// docs/BlizzardScriptAPI.md. Backs `EditBox:SetCursorPosition` /
// `GetCursorPosition` (`EditBox::Methods`), the modern cursor / focus /
diff --git a/src/frame/ClickMask.cpp b/src/frame/ClickMask.cpp
new file mode 100644
index 00000000..9a13ba49
--- /dev/null
+++ b/src/frame/ClickMask.cpp
@@ -0,0 +1,96 @@
+// This file is part of ClassicAPI.
+//
+// ClassicAPI is free software: you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software Foundation, either
+// version 3 of the License, or (at your option) any later version.
+//
+// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along with
+// ClassicAPI. If not, see .
+
+// `Button:RegisterForClicks("AnyUp" | "AnyDown" | ...)` — the two collective
+// click types later clients accept alongside the ten explicit ones.
+//
+// The engine's RegisterForClicks (FUN_SCRIPT_BUTTON_REGISTERFORCLICKS) walks
+// its string arguments, SStrCmpI's each against exactly ten literals
+// (LeftButtonDown … Button5Up), treats anything else as contributing NOTHING,
+// and ASSIGNS the OR of what it recognized to the button's click mask. So on
+// this client `RegisterForClicks("AnyUp")` did not fall back to the default —
+// it set the mask to zero and the button silently stopped responding to every
+// real click (Button:Click bypasses the mask, so programmatic clicks kept
+// working and hid the breakage — which is exactly how it bit the click-bracket
+// test harness on 2026-09-14).
+//
+// We don't reimplement the parser. The override appends the five names each
+// collective stands for onto the Lua stack — AnyUp -> the five *Up names,
+// AnyDown -> the five *Down names — and tail-calls the engine's own function,
+// which then sees the collectives (0) plus their expansions (0x1F00 / 0x001F)
+// and does everything else itself: the self typecheck, the parse, the setter
+// (FUN_BUTTON_SET_CLICK_MASK), the error text. Appending rather than replacing
+// keeps the reshape trivially safe: the engine's loop stops at the first
+// non-string, exactly as before, and its unknown-name -> 0 rule already makes
+// the leftover "AnyUp" string inert.
+//
+// Registered on the Button method registry, where the engine's entry lives;
+// the registrar pushes each new node to the front of its bucket chain and the
+// dispatcher walks from the front, so the most recent registration wins (the
+// Texture::Desaturation mechanism), and CheckButton inherits it through the
+// type walk. Re-registration is the one binding style another DLL or addon
+// can silently displace, so it is reserved for names nobody else contends —
+// unlike TargetUnit (see CLAUDE.md), no loaded DLL or addon has cause to
+// replace RegisterForClicks.
+
+#include "Game.h"
+#include "Offsets.h"
+#include "baselib/Ascii.h"
+
+namespace Frame::ClickMask {
+
+namespace {
+
+// The engine's own click-type names, in mask-bit order.
+constexpr const char *kUpNames[] = {"LeftButtonUp", "MiddleButtonUp", "RightButtonUp",
+ "Button4Up", "Button5Up"};
+constexpr const char *kDownNames[] = {"LeftButtonDown", "MiddleButtonDown",
+ "RightButtonDown", "Button4Down", "Button5Down"};
+constexpr int kNameCount = 5;
+
+int __fastcall Script_RegisterForClicks(void *L) {
+ using namespace Game::Lua;
+ // Bound the scan to the caller's arguments; the names appended below must
+ // not be rescanned. The engine's loop stops at the first non-string too.
+ const int top = GetTop(L);
+ for (int i = 2; i <= top; ++i) {
+ if (!IsString(L, i))
+ break;
+ const char *name = ToString(L, i);
+ const char *const *expansion = nullptr;
+ if (Ascii::EqualCI(name, "AnyUp"))
+ expansion = kUpNames;
+ else if (Ascii::EqualCI(name, "AnyDown"))
+ expansion = kDownNames;
+ if (expansion != nullptr)
+ for (int k = 0; k < kNameCount; ++k)
+ PushString(L, expansion[k]);
+ }
+ return reinterpret_cast(Offsets::FUN_SCRIPT_BUTTON_REGISTERFORCLICKS)(L);
+}
+
+const Game::Lua::FrameMethodEntry g_methods[] = {
+ {"RegisterForClicks", &Script_RegisterForClicks},
+};
+
+void RegisterLuaFunctions() {
+ Game::Lua::RegisterFrameMethods(
+ reinterpret_cast(Offsets::VAR_BUTTON_METHOD_REGISTRY), g_methods,
+ static_cast(sizeof(g_methods) / sizeof(g_methods[0])));
+}
+
+const Game::ModuleAutoRegister _autoreg{&RegisterLuaFunctions};
+
+} // namespace
+
+} // namespace Frame::ClickMask