You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
action modifier doesn't fire when inside shadow root #18303
The way the {{action modifier works is by adding event handlers to the applications rootElement (most often body in non-tests), when the template will be rendered into a shadow root it is intentionally disconnected from the event bubbling that would eventually bubble to the document's body (or application rootElement if configured differently. This is a feature (of the shadow root system), not a bug. The reason onclick= works is because the event listener is attached directly to the element in question, and does not rely on any bubbling out of the shadow root.
The "correct" solution here would be to avoid both forms of {{action and use {{on universally.
Since this isn't really a bug (and {{on works properly here already) I'm going to go ahead and close this, mostly as a "wontfix" because its basically impossible to fix...
Activity
rwjblue commentedon Aug 23, 2019
The way the
{{actionmodifier works is by adding event handlers to the applicationsrootElement(most oftenbodyin non-tests), when the template will be rendered into a shadow root it is intentionally disconnected from the event bubbling that would eventually bubble to the document'sbody(or applicationrootElementif configured differently. This is a feature (of the shadow root system), not a bug. The reasononclick=works is because the event listener is attached directly to the element in question, and does not rely on any bubbling out of the shadow root.The "correct" solution here would be to avoid both forms of
{{actionand use{{onuniversally.rwjblue commentedon Aug 23, 2019
Since this isn't really a bug (and
{{onworks properly here already) I'm going to go ahead and close this, mostly as a "wontfix" because its basically impossible to fix...knownasilya commentedon Aug 23, 2019
@rwjblue thanks for the answer and quick reply!