blockly > Field > repositionForWindowResize

Field.repositionForWindowResize() method

A developer hook to reposition the WidgetDiv during a window resize. You need to define this hook if your field has a WidgetDiv that needs to reposition itself when the window is resized. For example, text input fields define this hook so that the input WidgetDiv can reposition itself on a window resize event. This is especially important when modal inputs have been disabled, as Android devices will fire a window resize event when the soft keyboard opens.

If you want the WidgetDiv to hide itself instead of repositioning, return false. This is the default behavior.

DropdownDivs already handle their own positioning logic, so you do not need to override this function if your field only has a DropdownDiv.

Signature:

repositionForWindowResize(): boolean;

Returns:

boolean

True if the field should be repositioned, false if the WidgetDiv should hide itself instead.