Registry Mirror
Skip to content

FieldMultilineInput can overflow the page #4695

Open

Description

@dionytadema

Describe the bug

When a FieldMultilineInput has too many paragraphs of text, the block grows very large, and when editing it's value the input box may overflow the page.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://blockly-demo.appspot.com/static/demos/blockfactory/index.html
  2. Click on 'Workspace Factory'
  3. Import Custom Blocks > From Javascript
  4. Create and select the file with these contents:
Blockly.Blocks['multiline'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("print")
        .appendField(new Blockly.FieldMultilineInput("default"), "NAME");
    this.setColour(230);
 this.setTooltip("");
 this.setHelpUrl("");
  }
};

  1. Add the multiline block
  2. Add lines ultil text overflows the workspace/page

Expected behavior

I expected this to be handled in a cleaner way, perhaps a limit of lines in the input and a scrollbar if that limit is exeded.

Right now this issue can break the layout of pages that integrate blockly and use the multiline.

Screenshots

Block getting large when multiple lines are added:
works

Input overflowing the workspacce and breaking the page:
overflows

Desktop:

  • OS: Windows
  • Browser: Chrome
  • Version 88

Stack Traces

Not aplicable

Additional context

Activity

  1. added
    status: triage
    on Mar 11, 2021
  2. BeksOmega commented on Mar 11, 2021

    @BeksOmega
    Contributor

    Hmmm normal text fields can also cause overflows (and I assume they can break the page layout). What's your expected behavior in a situation like below?
    text-input-overflow

    The two ideas I can come up with (adding a horizontal scroll bar, or forcing the block within the view bounds) both seem inelegant :/

  3. dionytadema commented on Mar 12, 2021

    @dionytadema
    Author

    Normal fields can indeed also overflow, but at least they are bounded to a max width as you can see. This makes it less likely that a user makes the text overflow outside of the workspace.

    Actually very weird that they can extend beyond the wraping div my page uses, as that has overflow: hidden so should not be able to overflow

    To me the best solution would be taking the folowing steps:

    • Limit the height of the block to ~8 lines
    • Make sure that the input box also shows multiple lines if a single line wraps (currently the line wraps but input box doesn't get larger, making it kinda hard to see all your text
    • If possible add a scrollbar, and scrolling behavior to the input box (scrollwheel does nothing right now)
    • Maybe add an elipsis ( ⋮ <or a vertical one) on the last line if more then 8 lines are present in the block

    So it would look like this when inactive
    Capture
    And like this when active
    Untitled

    It would not 'fix' the overflow issue but it would make users a lot less likely to run into it. As they will naturally try to fit the block they are working on within the view

    Another inelegant solution would be reusing the popup that appears for dropdowns, as that one already positions itself within the view. but it don't think that would be intuitive

  4. added and removed
    status: triage
    on Mar 12, 2021
  5. added this to the Bug Bash Backlog milestone on Mar 12, 2021
  6. gonfunko commented on Oct 18, 2021

    @gonfunko
    Contributor

    This issue was also reported on the forum: https://groups.google.com/g/blockly/c/g2xM0gnAbiE

  7. MrAndrewMal commented on Sep 1, 2022

    @MrAndrewMal

    Hmmm normal text fields can also cause overflows (and I assume they can break the page layout). What's your expected behavior in a situation like below? text-input-overflow

    The two ideas I can come up with (adding a horizontal scroll bar, or forcing the block within the view bounds) both seem inelegant :/

    In this case, I think the canvas (view area) should move with the cursor.
    I want to implement such a feature in my fork. How can I detect overflow in FieldTextInput?

  8. added theissue type on Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    • Status
      Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions