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

Right-click menu is broken when the page has been scrolled #1329

Closed
3 of 11 tasks
rachel-fenichel opened this issue Sep 19, 2017 · 2 comments
Closed
3 of 11 tasks

Right-click menu is broken when the page has been scrolled #1329

rachel-fenichel opened this issue Sep 19, 2017 · 2 comments
Labels
component: coordinates issue: bug Describes why the code or behaviour is wrong

Comments

@rachel-fenichel
Copy link
Collaborator

rachel-fenichel commented Sep 19, 2017

Problem statement

  • Bug report
  • Feature request

Right-clicking on Blockly when it's inside a page that has been scrolled should not be a problem.

Expected Behavior

Right-clicking when the page has been scrolled should leave the page scroll as-is and show the Blockly context menu where the mouse is.

Actual Behavior

Right-clicking scrolls the page back to the start and shows the context menu in the wrong location.

The gif below starts when only the number block is visible.
The page has been scrolled to the right but not down. I right-clicked above the number block (which is only there to provide a position reference).
The page jumped to the left, and the context menu showed up in the wrong place.

89045725-1101-4066-b639-dbb9b5a07e80

Steps to Reproduce

Stack Traces

N/A

Operating System and Browser

Tested on:

  • Desktop:

    • Chrome
    • Firefox
    • Safari
    • Opera
    • IE 10+
    • IE 11
    • EDGE
  • Smartphone/Tablet/Chromebook (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

Additional Information

N/A

@rachel-fenichel rachel-fenichel added affects: develop component: coordinates issue: bug Describes why the code or behaviour is wrong labels Sep 20, 2017
@rachel-fenichel
Copy link
Collaborator Author

The problem is that the context menu calls menu.setAllowAutoFocus(true) when the menu is created, before it has been shown on the screen. When it is shown it is placed at the top of the screen before being moved to the correct location. The focus goes with it, changing the window scroll.

FieldDropdown uses the same menu object (goog.ui.menu) but waits to call menu.setAutoFocus(true) until after the menu has been shown. Since the focus has not been automatically sent, it then calls menuDom.focus(). ContextMenu needs similar code.

@rachel-fenichel
Copy link
Collaborator Author

Fixed by #1332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: coordinates issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

No branches or pull requests

1 participant