Only invalidate when value is actually changed

Selecting the input should not invalidate the selection as it is still valid. So instead check for a change and only invalidate then.