Input fields loses focus when related validation changes

Issue #947 resolved
Arkadiusz Lach created an issue

When string field is validated and we change its value, after first character (assuming that’s what is validated), error disappears but the input loses focus and it changes into another field while keeping the typed text, visible in gif below.

This code should be enough to reproduce it (MonsterData is just SO as seen in the gif).

    [ValidateInput("IsNameValid", "Name can not be empty", InfoMessageType.Error)]
    public string Name;

    [InlineEditor(InlineEditorModes.GUIAndHeader)]
    public MonsterData Monster;

    private bool IsNameValid()
    {
        return Name.Length != 0;
    }

This is not really related to ValidateInput only since replacing it with this code also leads to the same bug.

    [ReadOnly, HideIf("IsNameValid")]
    public string NameWarning = "Name can not be empty";

What seems to help fix it is using DelayedProperty in ValidateInput. After the delay, validation error disappears and the input still has focus with proper value.

Comments (1)

  1. Tor Esa Vestergaard

    This issue has very likely been resolved with the upcoming Odin beta patch 3.3.0.2 which will release this week. At least, we cannot make it happen any more, but it can sometimes be challenging to replicate.

    If the issue persists, please let us know.

  2. Log in to comment