Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Checkbox] Support onChange for cursor keynav #295

Merged
merged 3 commits into from
Dec 13, 2018

Conversation

lubber-de
Copy link
Member

@lubber-de lubber-de commented Dec 11, 2018

Description

Changing Radio-Button Selections via Cursor Key-Navigation was not triggering the onChange Event

Testcase

  • Click an option of the Radio Button Group
  • User cursor keys to switch between the options

Unfixed

Fixed

Closes

Semantic-Org/Semantic-UI#6676

@lubber-de lubber-de added type/bug Any issue which is a bug or PR which fixes a bug lang/javascript Anything involving JavaScript state/awaiting-reviews Pull requests which are waiting for reviews tag/sui-issue Taken from an existing Issue/PR of SUI labels Dec 11, 2018
y0hami
y0hami previously approved these changes Dec 11, 2018
Copy link
Member

@y0hami y0hami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ColinFrick
Copy link
Member

You can change the value of a radio box with the keyboard even if beforeChecked / beforeUnchecked returns false.

Option 2 is "disabled":
https://jsfiddle.net/2qrxm9kh/

@y0hami y0hami added 🐛 bugfix and removed type/bug Any issue which is a bug or PR which fixes a bug labels Dec 11, 2018
@lubber-de
Copy link
Member Author

lubber-de commented Dec 11, 2018

@ColinFrick 😮 That was quite challenging, but keynav is now stopped if next option does not allow to be checked or current option does not allow to be unchecked
https://jsfiddle.net/ujkdreqs/

Copy link
Contributor

@prudho prudho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why all checkboxes weren't running... then I saw I was dumb 😐

LGTM

@y0hami y0hami merged commit 0572fa9 into fomantic:develop Dec 13, 2018
@lubber-de lubber-de deleted the fix/6676/radio_keynav_onchange branch December 13, 2018 10:22
@y0hami y0hami removed state/awaiting-reviews Pull requests which are waiting for reviews labels Dec 17, 2018
This was referenced Dec 21, 2018
@lubber-de lubber-de added this to the 2.7.0 milestone Jan 16, 2019
y0hami pushed a commit that referenced this pull request Jan 28, 2019
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 the `change event`, but it never had any impact, just because the module itself did not have any `onChange` event until #295
That said, in conclusion the onchange event was now called twice: In the `set` methods aswell as in the `module` 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 


Closes #399, #400
@exoego exoego removed the 🐛 bugfix label May 1, 2019
@exoego exoego added the type/bug Any issue which is a bug or PR which fixes a bug label May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/javascript Anything involving JavaScript tag/sui-issue Taken from an existing Issue/PR of SUI type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants