Skip to content

Fix portrait right-click on ApplicationV2 actor sheets - #230

Open
tasandberg wants to merge 2 commits into
Aedif:masterfrom
tasandberg:fix-portrait-right-click-appv2
Open

Fix portrait right-click on ApplicationV2 actor sheets#230
tasandberg wants to merge 2 commits into
Aedif:masterfrom
tasandberg:fix-portrait-right-click-appv2

Conversation

@tasandberg

@tasandberg tasandberg commented Jul 6, 2026

Copy link
Copy Markdown

Fixes #226. Likely also resolves #163 and #191 (v2 / Tidy sheets).

Portrait right-click → Art Select silently stopped working on ApplicationV2 actor sheets (Foundry v14 made these the default): _modActorSheet is registered on renderActorSheet only, but V2 sheets fire renderActorSheetV2 — so the handler never runs, with no console error (#226). This registers on both hooks and gates on actorSheet.isEditable (the third hook arg differs across v1/v2).

Element normalization: a DocumentSheetV2 root is a <form>, and form[0] returns the form’s first control, not undefined — so html[0] ?? html picks the wrong node and the portrait is never found. This detects jQuery via its .jquery marker instead: html.jquery ? html[0] : html.

Tested live in Foundry v14: portrait right-click opens Art Select on dnd5e 5.0.4 v2 sheets, a third-party v2 sheet, and the legacy v1 sheet (unchanged).

#163 (Default vs Legacy 5e) and #191 (Tidy) share the same v2-hook root cause; the portrait path should be resolved, though #163 also mentions prototype-token config (a separate path) and #191 depends on the Tidy portrait carrying a matched selector.

@tasandberg
tasandberg marked this pull request as draft July 6, 2026 23:41
…he element

A DocumentSheetV2 root is a <form>; html[0] returns its first form control
(not undefined), so html[0] ?? html picked the wrong node and the portrait was
never found. Detect jQuery via .jquery instead.
@tasandberg
tasandberg marked this pull request as ready for review July 7, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

right click Art Select no working Default 5e Character sheets are incompatible

1 participant