Skip to content

Field height jumps when errors appear because of helperText #51

@Philipp91

Description

@Philipp91

Same issue as here.

A field without error and warning has no helperText set. In that case, material-ui's will not reserve any space for the helper text. When the field becomes validated and is invalid, the errorText is added and the height of the field increases. This leads to a visible jump in the page layout, which is especially bad if there are many invalid fields, or if it happens often as users click through the fields.

To reproduce in the demo linked from the main page, just focus and unfocus the "Email" field and watch the remainder of the form move down.

Any proper solution will have to reserve this space always, even when no error message is present. This leads to a less dense form. In my opinion/application, the errorText space is just enough to make the form appear nice when there are no errors, i.e. I don't have to code any padding/margin etc. When an error does appear, it comes quite close to the field just below, but I prefer that over the visual jump.

If you're willing to change the default behavior of formik-material-ui, I'm happy to send a PR that implements this fix (similar to this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions