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

[hotkeys] Fix sorting for global hotkey groups with labels #2938

Conversation

jeroenvisser101
Copy link
Contributor

Hotkey groups with labels that are have the global={true} prop should
now also be alphabetically sorted.

Fixes #2439

Changes proposed in this pull request:

The change will prioritize global hotkeys, but still sort them with other global hotkey groups. If a hotkey group is both global but also has a group name, it will still sort it alphabetically.

Reviewers should focus on:

Sorting and order of global hotkey groups with a group name set.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/blueprint, @jeroenvisser101! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@jeroenvisser101 jeroenvisser101 force-pushed the jeroenvisser101/global-hotkey-sorting branch from 2af74d4 to 7712ea8 Compare September 14, 2018 15:57
Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

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

any way you could add a test to hotkeysTests for this?

hotkeys.sort((a, b) => {
if (a.global) {
return b.global ? 0 : -1;
if ((a.global && b.global) || (!a.global && !b.global)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

how about if (a.global === b.global)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! That's a good one

Copy link
Contributor

Choose a reason for hiding this comment

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

cool, waiting for a push from you.

Hotkey groups with names that are have the global={true} prop should
now also be alphabetically sorted.

Fixes palantir#2439
@jeroenvisser101 jeroenvisser101 force-pushed the jeroenvisser101/global-hotkey-sorting branch from 7712ea8 to 090dbd4 Compare September 17, 2018 22:14
@jeroenvisser101
Copy link
Contributor Author

@giladgray I added tests, and they do test the sorting, but they only test the appearance order of the labels. I think that should do it, but please let me know if there are better ways of doing that.

Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

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

looks good, thanks @jeroenvisser101!

@giladgray giladgray merged commit 68361fc into palantir:develop Sep 20, 2018
@jeroenvisser101 jeroenvisser101 deleted the jeroenvisser101/global-hotkey-sorting branch September 20, 2018 13:00
@jeroenvisser101
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants