The action should instead be enabled/disabled according to whether any changes have been made.
|Resolved||matmarex||T206000 Apply changes action is enabled on several dialogs before any changes are made|
|Resolved||matmarex||T206534 The gallery dialog's Apply changes action is always enabled if there are images in the gallery|
- Mentioned In
- T209648: Changing text in a TargetWidget does not enable dialog's "Apply" button (in media, gallery, reference dialog) until second keypress
T206000: Apply changes action is enabled on several dialogs before any changes are made
T207620: Slightly strange behaviour around removing image from gallery using VE (gallery dialog normalizes everything it touched)
- Mentioned Here
- T212809: [Regression pre-wmf.12] Insert button stays disabled while trying to add a gallery
T209542: [Regression wmf.4] "Publish Changes" button stays disabled while trying to re-edit a page
T209451: [Regression pre-wmf.6] Adding a new image to an existing gallery is not enabling the "Apply changes" button
Ok, there are at-least two workflows that are broken now :(
- Adding a new image to an existing gallery is not enabling the "Apply changes" button, reported: T209451
- Sometimes I am seeing the "Apply changes" button staying enabled even if there hasn't been any changes (Haven't found the exact steps yet for this, trying to).
@Ryasmeen I can help you here! I think you should find that everything in the Options tab behaves as you would expect, whereas in the Images tab, once a change has made the action stays enabled, even if you undo. This is essentially because the Options tab relates to attributes on the gallery node itself, whereas the Images tab relates to descendant nodes (the gallery caption is also a descendant of the gallery).
It's not ideal, but I think it's better than what went before... I guess the task should arguably remain open until fixed properly, but having to check changes to the gallery's descendant nodes is a bit more complicated.
 except for the gallery caption
I assumed that disabling the "Apply" button again after changes are undone was not a requirement here, so I did not try to get it working. @Tchanders is correct that it is a bit more difficult for this dialog than for others. But I looked into it now and it actually seems feasible, so let's do it as well. I'll submit a separate patch for it (we should get the existing one merged quickly to fix the regression).
After this new patch is merged, undoing the changes to an image caption or alt text, or to the gallery caption, or to the order of images, or removing a previously added image, will now disable the "Apply" button again.
The following cases will *not* disable the button again, and it is not feasible to implement them:
- Re-adding a previously removed image with identical options
- Changing any caption to the old value by other means than "Undo"
- Changing image caption or alt text to the old value after switching to a different image and then back
@Tchanders: Yeah, I understand your point :) My comment was however about a straightforward scenario where I just re-opened the gallery dialog and saw the "Apply Changes" button being enabled, didn't do any "undo" action before that step. It's probably a very edge case therefore finding it difficult to replicate.
@Ryasmeen No, nothing relevant to this task was reverted, AFAIK. These cases are unfeasible to fix due to how the dialog stores its state internally (either we don't have the "old" state to compare to, or we don't have a way of comparing that ignores internal changes that don't matter), and would require more work to resolve than I'm comfortable doing on a random task not really related to what we're working on as a team.
(I would prefer filing a separate task if we want to track that work.)
All other cases will be fixed by the latest patch I submitted (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/473840). Which, by the way, is stalled: @Esanders left a -1 review that I disagreed with and I'm waiting for a reply.