Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events does not correctly bubble up the DOM tree #119

Closed
egil opened this issue May 3, 2020 · 2 comments · Fixed by #230
Closed

Events does not correctly bubble up the DOM tree #119

egil opened this issue May 3, 2020 · 2 comments · Fixed by #230
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed input needed When an issue requires input or suggestions
Milestone

Comments

@egil
Copy link
Member

egil commented May 3, 2020

When an element is clicked using the Click() event dispatch helper, it doesn't cause the event to bubble up the DOM tree like it does in the browser.

@egil egil added bug Something isn't working input needed When an issue requires input or suggestions labels May 3, 2020
@egil
Copy link
Member Author

egil commented May 4, 2020

According to EventDelegator.ts, this is the list of non-bubbling events:

'abort', 'blur', 'change', 'error', 'focus', 'load', 'loadend', 'loadstart', 'mouseenter', 'mouseleave', 'progress', 'reset', 'scroll', 'submit', 'unload', 'DOMNodeInsertedIntoDocument', 'DOMNodeRemovedFromDocument'

plus, if an element has the disabled attribute, these events are also disabled

'click', 'dblclick', 'mousedown',

@egil egil modified the milestones: beta-7, beta-8 May 6, 2020
@egil egil added the help wanted Extra attention is needed label May 28, 2020
@egil egil modified the milestones: beta-8, v1.0.0 Jul 29, 2020
@egil
Copy link
Member Author

egil commented Aug 30, 2020

These test should pass when this is fixed:

public class EventBubblingTest : TestContext
{
	[Fact(DisplayName = "When clicking on an element with an event handler, " +
						"event handlers higher up the DOM tree is also triggered", Skip = "fix with #119")]
	public void Test001()
	{
		var cut = RenderComponent<ClickEventBubbling>();

		cut.Find("span").Click();

		cut.Instance.SpanClickCount.ShouldBe(1);
		cut.Instance.HeaderClickCount.ShouldBe(1);
	}

	[Fact(DisplayName = "When clicking on an element without an event handler attached, " +
						"event handlers higher up the DOM tree is triggered", Skip = "fix with #119")]
	public void Test002()
	{
		var cut = RenderComponent<ClickEventBubbling>();

		cut.Find("button").Click();

		cut.Instance.SpanClickCount.ShouldBe(0);
		cut.Instance.HeaderClickCount.ShouldBe(1);
	}
}

@egil egil self-assigned this Oct 2, 2020
@egil egil mentioned this issue Oct 8, 2020
9 tasks
@egil egil linked a pull request Oct 8, 2020 that will close this issue
9 tasks
@egil egil closed this as completed Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed input needed When an issue requires input or suggestions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant