View Issue Details

IDProjectCategoryView StatusLast Update
0019098MMW 5Generalpublic2022-09-14 14:33
Reporterzvezdan Assigned To 
PriorityhighSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version5.0 
Target Version5.2Fixed in Version5.0.4 
Summary0019098: Input event of edit or editable dropdown should not fire change event
DescriptionHere is why:
A) working fine:
1. select large number of files;
2. open Auto-organize;
3. select any item from the Destination dropdown -> OK button is disabled for a few seconds;
4. wait until OK button is enabled again;
5a. give focus to other window (make sure that Auto-organize is visible) -> OK button is still enabled; or
5b. click on Destination label or any other non-active part of dialog -> OK button is still enabled;
6. repeat 3-5 with any other item from the dropdown -> OK button is always enabled when giving focus to other window;

B) working wrong:
1. select large number of files;
2. open Auto-organize;
3. edit text in the Destination dropdown -> OK button is disabled for a few seconds;
4. wait until OK button is enabled again;
5a. give focus to other window (make sure that Auto-organize is visible) -> OK button is disabled for a few seconds; or
5b. click on Destination label or any other non-active part of dialog -> OK button is disabled for a few seconds.

You see, your own Auto-organize is working twice to refresh the list, when text in the edit box is changed and when it loosed focus.
TagsNo tags attached.
Fixed in build

Activities

Ludek

2022-05-26 12:49

developer   ~0068265

Last edited: 2022-05-26 12:49

I would rather say that the bug is that another the 'change' event is fired on losing the focus.
Firing 'change' event on input is fine -- otherwise e.g. search bar wouldn't work etc.
Whenever the input text is changed then it is expected to fire the 'change' event.

zvezdan

2022-05-26 12:53

updater   ~0068266

Firing change on loosing focus is default intended behavior. Here is the excerpt from the web (https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event):
"The input event is fired every time the value of the element changes. This is unlike the change event, which only fires when the value is committed, such as by pressing the enter key, selecting a value from a list of options, and the like."

zvezdan

2022-05-26 12:57

updater   ~0068267

I already resolved that problem in my add-on by checking in the change event handler if the current value is the same is the previous one. But it is a hack. The right approach would be to listen on both input and change events.

Ludek

2022-05-26 13:12

developer   ~0068268

Last edited: 2022-05-26 13:18

Hmm, based on
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event
you seem to be right that differentiate 'change' and 'input' would be more correct here, there is just a risk of regressions for all the places where only 'change' event is listened atm.
Plus mostly the "not so wanted" need to listen both 'input' and 'change' events -- which is not a need atm.

zvezdan

2022-05-26 13:30

updater   ~0068269

You are right that there would be a risk of regressions and all such controls should be tested.

The simple edit box (not a part of the editable dropdown) doesn't need listening on the 'change' event, you could safely replace all such listeners with the 'input' event. The 'change' event handler is needed only to register when user clicked on the item from the list of dropdown control because the 'input' event is not fired in such case.

zvezdan

2022-05-26 13:36

updater   ~0068270

Well, I just tested and I was wrong. The 'change' event is needed even for edit boxes because the 'input' event is not fired when the control has changed its content by script, but only when user type the text.