Skip to content

Focusing an input causes blocks to move on mobile #10277

Description

@nimeratus

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

When a block is too wide to fit on the screen, focusing its inputs causes the block's left edge align to the flyout, which makes the input go offscreen (or at least parts of the screen where it shouldn't be). Also, it's annoying to keep dragging the block back to its original position. Sometimes it moves the block so far that it's hard to drag it back.

Reproduction steps

  1. Open a Scratch or a MakeCode editor on a mobile
  2. Combine blocks until it's so wide that you can't see the entire thing at once
    • in the MakeCode editor it doesn't happen with some input types (those that open a popup with a text box), but it happens with eg. the speed input
  3. Scroll to the rightmost input and try to type into it

On a computer you can reproduce the bug by making a resize event after focusing the input. I think it happens when the virtual keyboard resizes the window

Priority

Work effort: I think it can be fixed by editing this function to scroll instead of moving the blocks, but I didn't test this
Impact: it can happen to anyone who makes a long block on mobile
Workaround: manually drag the block back to the original position after editing the field

Stack trace

Screenshots

Before the bug
Image

After closing the keyboard
Image

Image Image

Browsers

Android mobile, Chrome desktop

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions