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

Issues with right-click on block #3905

Open
pikurasa opened this issue Jun 14, 2024 · 16 comments
Open

Issues with right-click on block #3905

pikurasa opened this issue Jun 14, 2024 · 16 comments

Comments

@pikurasa
Copy link
Collaborator

Right now, on https://musicblocks.sugarlabs.org/, if you right-click on a block you get two menus. You should only get one.

Screenshot from 2024-06-14 17-33-36

@walterbender
Copy link
Member

I briefly see the larger menu but it goes away when the smaller menu appears. What browser are you using?

@apsinghdev
Copy link
Member

Probably, The reason for this problem is conflicting event listeners. I guess there is a code that checks whether the right-click event triggered on block area or non-block area and that check is failing in this case.

@pikurasa
Copy link
Collaborator Author

I briefly see the larger menu but it goes away when the smaller menu appears. What browser are you using?

Version 120.0.6099.224 (Official Build) built on Debian 11.8, running on Debian 11.7 (64-bit)

@akshayw1
Copy link

@pikurasa , Is it resolved, Should I take to this work on?

@haroon10725
Copy link
Contributor

@akshayw1 Yes I am working on it.

@apsinghdev
Copy link
Member

@pikurasa , Is it resolved, Should I take to this work on?

You don't need to ask for permission. If the issue is not resolved you can raise a PR.

@haroon10725
Copy link
Contributor

@apsinghdev I am working on it.

@apsinghdev
Copy link
Member

@apsinghdev I am working on it.

Great, it's good to hear that you are working on it. I am just letting him know the flow we use.

@nilaygit-10721
Copy link

anyone working on this?

@pikurasa
Copy link
Collaborator Author

pikurasa commented Nov 9, 2024

anyone working on this?

Please test it first. IRRC it may have been fixed...

@MostlyKIGuess
Copy link
Contributor

MostlyKIGuess commented Dec 7, 2024

I briefly see the larger menu but it goes away when the smaller menu appears. What browser are you using?

haha this doesn't happeen locally for me actually, I am trying to fix this by adding a separate case of just not rendering the bigger menu, feel like that would be better.

Edit 1 : I have added some code, if someone is able to reproduce the issue, would they like to check the code and see if it works or not?

@suryaanshah
Copy link
Contributor

suryaanshah commented Dec 29, 2024

Hello, I have been trying to reproduce this and confirm its presence. However not as the main issue but rather for me as mentioned by @/walterbender the larger menu is disappearing after a while.

I also confirms that it "appears" like this issue isn't present running the local index.html file. But I suspect it may be because the website is taking some time to load the menus whereas the local file is doing that quickly hence missing the common human eye. I can be wrong here though.

For this, I may try to also test it on a local server and see if it makes any difference there.

sugarlabs-musicblocks-double-menu3905.mp4

NOTE: I also tried to test in the video if this issue is only with the blocks and not with other "clickable" objects. like the turtle or other menus and components etc but found that it is only present while right clicking the blocks

NOTE 2: I observed that unlike the screenshot, for me both the menus are concentric circles and not overlapping as shown.

Probably, The reason for this problem is conflicting event listeners. I guess there is a code that checks whether the right-click event triggered on block area or non-block area and that check is failing in this case.

I will now check using the debugger about what lines of code are responsible. It is helpful to know from the maintainers about the context as @/apsinghdev has mentioned.

@suryaanshah
Copy link
Contributor

An update:

Root Cause: checking nativeButton == 2 for rightClick event is conflicting with the normal left click.
The code-segment I am referring to is in block.js:

// We might be able to check which button was clicked.
            if ("nativeEvent" in event) {
                if ("button" in event.nativeEvent && event.nativeEvent.button == 2) {
                    that.blocks.stageClick = true;
                    docById("wheelDiv").style.display = "none";
                    that.blocks.activeBlock = thisBlock;
                    piemenuBlockContext(that);
                    return;

Potential Solutions:

  • We could change it to a separate eventHandler for RightClick in the same Class (this)
  • We could also just add event.preventDefault(); // Prevent the default context menu from showing

@apsinghdev
Could you please give me some insights and help in fixing this since I am a little new to this code-base and may need a bit of time understanding what each function does.
Particularly, which part differentiates (in this file or other) between a block-click vs a non-block-click.

Any help is appreciated here. Thanks!

@walterbender
Copy link
Member

You can either right click on a block or on the canvas. There are two different menus. But both menus appear when you right click on the canvas.

@Shyam-Raghuwanshi
Copy link
Contributor

hi @walterbender @pikurasa I tryed in Edge and Brave but not able to produce the issue

@walterbender
Copy link
Member

On FF on Fedora when you right click on a block, the canvas menu appears, then the block menu, then the canvas menu disappears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants