[Checkbox] Call onChange only once and dont at all on "set checked" (and others) #403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The keypoint here is, that this PR basically fixes a very old behavior in SUI:
According to the docs the behaviors
set checked|unchecked|enabled|disabled|determinate|indeterminate
are not supposed to run callbacks. But they actually always did (!) They ever since triggered thechange event
, but it never had any impact, just because the module itself did not have anyonChange
event until #295That said, in conclusion the onchange event was now called twice: In the
set
methods aswell as in themodule
methods. 😞 The onChange event has to be kept, otherwise the keynav will not notify any change to the event system, so i removed the (wrong) event triggering in the above mentioned behavior functions and put them outside instead.In addition i also hotfixed #295, because the beforeChecked/Unchecked methods were not called correctly
Testcase
#399
https://jsfiddle.net/7vjLsr1f/
#400
https://jsfiddle.net/3sbreo71/
Closes
#399
#400