@Nikki found the following two issues:
- When you edit a statement and then cancel, the constraint violation indicator is present, but clicking it has no effect.
- After some edits (e. g. adding a qualifier to a statement, or changing the rank), you end up with two constraint violation indicators, and only the second one is clickable.
I think that they’re both caused by the same problem: Wikibase’s UI code restores the old value DOM, including the constraint violation indicator, but all event handlers on the indicator are lost. (In the case of the edited statement, the second, functional violation indicator comes from T168627: Check constraints on new and edited statements.)
We need some place where WikibaseQualityConstraints can place those indicators and Wikibase won’t mess with them. In T95403, an empty indicators span was proposed, but it had to be reverted soon because it caused too many problems. Thiemo also proposed a different DOM layout, but apparently it has some problems and there was never any follow-up.
What should happen to those indicators when the statement is interacted with?
- When the user starts editing the statement, the indicators should be hidden, but not removed from the DOM.
- When the user cancels editing the statement, the indicators should be made visible again. This ought to preserve event handlers.
- When the users saves the statement, the indicators should be cleared. User scripts, gadgets etc. can re-add them by subscribing to the hooks from T167870: Add JS hooks for changes to statements.