Closed (fixed)
Project:
Flag
Version:
5.x-dev
Component:
Flag core
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Oct 2025 at 13:06 UTC
Updated:
22 Sep 2026 at 13:14 UTC
Jump to comment: Most recent
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
ivnishComment #7
tomdearden commentedHi,
I think maybe this change doesn't take proper account of all the possible configurations that a Flag can have. Specifically, an AJAX error is thrown when flagging a node for 'dialog'-style flags.
Steps to reproduce
The flag state changes on the page but the dialog box doesn't close and an AJAX error is visible in the browser console:
`An error occurred during the execution of the Ajax response: Error: cannot call methods on dialog prior to initialization; attempted to call method 'close'`
I don't understand the lifecycle of the dialog component well enough to propose a proper resolution, but a quick-and-dirty patch to check for a behavior type of 'modal' as well as for an XMLHttpRequest context when deciding whether to add the `#ajax` key to the submit button render array has stopped the issue occurring for me (albeit at the expense of a page reload vs. the nicer intended AJAX behaviour).
Comment #8
ivnishHi! Could you create a new issue?
Comment #9
tomdearden commentedOf course - no problem. Here it is:
https://www.drupal.org/project/flag/issues/3625010