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

Numbered checkbox items appear in wrong order #510

Open
bart-webleads opened this issue Nov 15, 2021 · 3 comments
Open

Numbered checkbox items appear in wrong order #510

bart-webleads opened this issue Nov 15, 2021 · 3 comments
Labels
bug report A submitted bug report, not yet validated.

Comments

@bart-webleads
Copy link

Describe the bug
Numbered checkbox items appear in kind of a resorted order...

Reproduction

CodePen:

https://codepen.io/bart-webleads/pen/KKvejPM

Expected behavior
The order for numbered items should not be changed.

@bart-webleads bart-webleads added the bug report A submitted bug report, not yet validated. label Nov 15, 2021
@digital-codes
Copy link

digital-codes commented Dec 13, 2021

Well, looking at your pen it is quite obvious: your options are {5: 'First', 2: 'Second', 3: 'Third', 4: 'Fourth'}. Ordering by key gives your output. Either you have a typo there (5 instead of 1) or you expected ordering by value instead.
I think this one could be closed.

@bart-webleads
Copy link
Author

Yes, but why are number keys ordered, and non-numbered keys not ? This is inconsistent behavior.

@digital-codes
Copy link

Hmm, probably because numbered keys are treated like array indexes. When you modify your example to "{5: 'First', 2: 'Second', 7: 'Third', 4: 'Fourth'}" (note the 7) you get the "correct" result, assuming you sort by the key. So I still think the problem is the documentation, not the behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report A submitted bug report, not yet validated.
Projects
None yet
Development

No branches or pull requests

2 participants