Skip to content

Fix double modal dialog when used in StreamField blocks#41

Open
fabinol wants to merge 3 commits into
mainfrom
fix-double-modal-init
Open

Fix double modal dialog when used in StreamField blocks#41
fabinol wants to merge 3 commits into
mainfrom
fix-double-modal-init

Conversation

@fabinol

@fabinol fabinol commented Jul 4, 2026

Copy link
Copy Markdown
Member

@aweakley I've picked up a bug since the Wagtail Upgrade on IC Base. This is the fix suggested by Claude and it's description:

create_instance_selector_widget() was being invoked twice for widgets
rendered inside StreamField blocks: once directly by the telepath
widget definition (which needs the widget API back synchronously),
and again by the Stimulus instance-selector controller's connect(),
triggered because the widget root also carries
data-controller="instance-selector". Each call bound its own click
handler, so a single click on the chooser button opened two stacked
modal dialogs -- requiring two dismissals to close if nothing was
selected.

Cache the widget API on the widget root so a second initialisation
call for the same element is a no-op.

Could you review to make sure it isn't doing something insane.

I did a static override at static/instance_selector/instance_selector_widget.js in ic-base

@fabinol fabinol requested a review from aweakley July 4, 2026 04:25
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.

1 participant