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

Bug 1619751 - Pin blame popup on click, dismiss on scroll or click elsewhere. #308

Merged
merged 1 commit into from Apr 23, 2020

Conversation

staktrace
Copy link
Contributor

I live-edited the dev web-server to test this, so the patch is applied there and you can try it out if you want.

Also note that if you test in Fenix you may run into mozilla-mobile/fenix#8779 which reopens the blame popup after scrolling. Doesn't happen in Fennec, and I intend to track down and fix the bug in Fenix soonish.

@staktrace staktrace requested a review from emilio April 23, 2020 17:17
@emilio
Copy link
Contributor

emilio commented Apr 23, 2020

Also note that if you test in Fenix you may run into mozilla-mobile/fenix#8779 which reopens the blame popup after scrolling. Doesn't happen in Fennec, and I intend to track down and fix the bug in Fenix soonish.

I suspect it won't happen with layout.reflow.synthMouseMove=false. Seems very similar to mozilla-mobile/fenix#9860.

@staktrace
Copy link
Contributor Author

I suspect it won't happen with layout.reflow.synthMouseMove=false. Seems very similar to mozilla-mobile/fenix#9860.

Indeed you are correct. Thanks for the tip!

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, though generally looks good.

}

BlamePopup.popup.addEventListener("mouseenter", this);
BlamePopup.popup.addEventListener("mouseleave", this);
window.addEventListener("click", this, {capture: true});
document.getElementById("scrolling").addEventListener("scroll", this, {capture: true});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passive: true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also why does this need to be capturing? Same for the scroll listener.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passive: true?

I don't think passive does anything for scroll events. At least APZ doesn't care about whether scroll listeners are passive or not. Maybe I'm mistaken?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also why does this need to be capturing? Same for the scroll listener.

The click needs to be capturing because if you e.g. click on a code fragment that produces a context menu, it seems to consume the click and then we end up with both the blame popup and the context menu. Having a capture listener here ensures we get the click even in that case. I can add a comment to that effect. The scroll listener probably doesn't need to be capturing, I can drop that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think passive does anything for scroll events. At least APZ doesn't care about whether scroll listeners are passive or not. Maybe I'm mistaken?

Ah, yeah, maybe I was thinking of wheel events, nvm.

The click needs to be capturing because if you e.g. click on a code fragment that produces a context menu, it seems to consume the click and then we end up with both the blame popup and the context menu. Having a capture listener here ensures we get the click even in that case. I can add a comment to that effect. The scroll listener probably doesn't need to be capturing, I can drop that.

Ah, so this is so that we don't hit the event.stopPropagation() in the context-menu code? That should probably be changed to something else... And actually given now we don't always recreate the menu it may not be needed at all anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed /capture/passive/ for the scroll listener. The passive won't help but it won't hurt either, so whatever.

For the click - I guess it's the stopPropagation() in the context-menu code, but I didn't actually verify. In general it seems like for things like this a capturing listener seems more robust.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems more reliable for hiding the popup, but not for showing it, right? Anyhow nbd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems more reliable for hiding the popup, but not for showing it, right? Anyhow nbd.

Ah, good point. I was only considering the hiding scenario at the time but you're right it probably is not as good for the showing scenario.

static/js/blame.js Outdated Show resolved Hide resolved
static/js/blame.js Show resolved Hide resolved
static/js/blame.js Outdated Show resolved Hide resolved
@staktrace staktrace merged commit 9c5bc5a into mozsearch:master Apr 23, 2020
@staktrace staktrace deleted the touchblame branch April 23, 2020 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants