elementary / elementary/granite

Existence of possiblity to induce incoherency between style and state in Granite.ValidatedEntry

Open
#587 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vala
Stars
329
Forks
65
Avg merge
1d 14h
Merged PRs (30d)
31

Description

### What Happened?

Currently it is possible to set the `is_valid` property of `Granite.ValidatedEntry` independent of its `changed` signal, however the style is only updated in the `connect_after` callback for the `changed` signal, so it the style only changes when the `text` attribute is changed. This has the possibility of leaving the widget in an incoherent state where the style doesn't reflect the value of the `is_valid` property.

### Steps to Reproduce

change the `is_valid` property without using the `changed` signal
```vala
var entry = new Granite.ValidatedEntry ();
entry.text = "text";
entry.is_valid = false;
```
here even though the state is invalid the styling would reflect a valid state

### Expected Behavior

I'm not entirely sure as to what the expected behavior here is, as this is more of a developer facing issue than a user facing issue. This is not even really an issue if the intended behavior is to use the `is_valid` property exclusively inside the `changed` signal. But it is weird that the API allows for the incoherence.

Supporting the change of `is_valid` outside the `changed` signal could be useful in cases where the validation condition might change outside of the widget without the value inside the widget changing. However this could be outside the scope of `Granite.ValidatedEntry`.

### OS Version

6.x (Odin)

### Software Version

Latest release (I have run all updates)

### Log Output

_No response_

### Hardware Info

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.