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

feat: Added support for single select in tree dropdown #217

Merged
merged 58 commits into from
Apr 18, 2019

Conversation

ellinge
Copy link
Collaborator

@ellinge ellinge commented Mar 12, 2019

What does it do?

Adds support for single select in the tree dropdown. Simple select ignores any children so this is a hybrid between the two.

Also ignores clicks for simple select when labels are disabled (only checked readonly)

The middle dropdown is radioSelect and the last one a simpleSelect
https://ellinge.github.io/react-dropdown-tree-select-test/#DevelopTemp-checkeddefault

Fixes #119

Type of change

  • Bug fix
  • New feature

src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Mar 12, 2019

Pull Request Test Coverage Report for Build 1058

  • 60 of 63 (95.24%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.7%) to 95.591%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/index.js 10 11 90.91%
src/tree-manager/index.js 18 20 90.0%
Totals Coverage Status
Change from base Build 1030: 0.7%
Covered Lines: 357
Relevant Lines: 364

💛 - Coveralls

@ellinge
Copy link
Collaborator Author

ellinge commented Mar 13, 2019

@mrchief this one should be up for grabs. I did not change the behaviour for simpleSelect so if that is something you think we should do instead, it would require additional changes.

I also noticed on the storypage that simpleSelect is not working great with default values, which also applies to this solution. Only one default value should be possible and should be deselected when selecting something else.

@mrchief
Copy link
Collaborator

mrchief commented Mar 13, 2019

I did not change the behaviour for simpleSelect so if that is something you think we should do instead, it would require additional changes.

Just one question - with this change, can we manage simpleSelect without the need of an additional flag?

I also noticed on the storypage that simpleSelect is not working great with default values, which also applies to this solution. Only one default value should be possible and should be deselected when selecting something else

Great! Thanks for taking notice and fixing it!

Copy link
Collaborator

@mrchief mrchief left a comment

Choose a reason for hiding this comment

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

Few comments to note

src/index.js Outdated Show resolved Hide resolved
src/tree-manager/flatten-tree.js Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/tree-manager/tests/singleSelect.test.js Outdated Show resolved Hide resolved
src/tree-node/node-label.js Show resolved Hide resolved
src/tree-node/index.js Outdated Show resolved Hide resolved
@ellinge
Copy link
Collaborator Author

ellinge commented Mar 14, 2019

I did not change the behaviour for simpleSelect so if that is something you think we should do instead, it would require additional changes.

Just one question - with this change, can we manage simpleSelect without the need of an additional flag?

@mrchief Not sure what you mean with an additonal flag. Simpleselect should still behave as before. Did not want to break that so added singleSelect. If you provide both simpleSelect and singleSelect it will behave as before (no children)

I also noticed on the storypage that simpleSelect is not working great with default values, which also applies to this solution. Only one default value should be possible and should be deselected when selecting something else

Great! Thanks for taking notice and fixing it!

Unfortunately did not fix the issue since that requires some more digging. Should be a separate issue.
Fixed now, se below

src/index.js Outdated Show resolved Hide resolved
src/tree-node/node-label.js Outdated Show resolved Hide resolved
src/tree-manager/flatten-tree.js Show resolved Hide resolved
src/tree-node/node-label.js Outdated Show resolved Hide resolved
mrchief and others added 5 commits April 13, 2019 20:27
# Conflicts:
#	.codeclimate.yml
#	.prettierrc
#	docs/src/stories/Options/index.js
#	src/checkbox/index.js
#	src/checkbox/index.test.js
#	src/index.js
#	src/tree-manager/flatten-tree.js
#	src/tree-node/index.js
#	src/tree-node/node-label.js
#	src/tree-node/node-label.test.js
#	src/tree/index.js
#	yarn.lock
@ellinge
Copy link
Collaborator Author

ellinge commented Apr 14, 2019

I bundled the selection of rendering / behaviour mode into a single prop instead like we discussed in the keyboard nav PR. We can fill the migration steps with additional breaking changes (for on action) and if bundle the text-props also.

Not sure how you want the guide formatted but perhaps you can update it to match your idea.

I added the textprops-bundle in this pr as well (without the new labels). With the onaction-changes we would cover all breaking changes needed for a release I think if we want to wait with ARIA/kryboard nav.

@mrchief
Copy link
Collaborator

mrchief commented Apr 16, 2019

I added the textprops-bundle in this pr as well (without the new labels). With the onaction-changes we would cover all breaking changes needed for a release I think if we want to wait with ARIA/kryboard nav.

Will it be too much to take out the bundle props out of this?

I think radioSelect, ARIA, keyboard nav are all backward compatible changes so we can merge them first and release them incrementally. onActions and bundle props then become part of the v2 release.

This release sequence lets v1 folks to not miss out on most new features. Upgrading to major versions is generally considered a bigger undertaking and makes people hesitant in upgrading which would cause them to miss out on accessibility and radio select for no good reason.

I'm open to arguments otherwise.

@mrchief mrchief removed the wip Work In Progress label Apr 16, 2019
@ellinge
Copy link
Collaborator Author

ellinge commented Apr 16, 2019

Well since you became reluctant with the prop additions I thought it would be odd to first add them and then in the next release move them. I see all these features as major additions and the migration steps simple enough to not scare any people away. Radio select and noaction could be 2.0 and wcag 2.x.x with this paving the path to naturally add new labels. But I can revert them...

Otherwise the major thing of 2.0 would be to the bundle of props and actually getting onAction to be useful without generating your own specific id:s to base your logic upon.

The addition of typings is also the reason why we found the bugs with onAction, which would also be part of the major update. Lots of candy to remove any hesitation from users imho.

@mrchief
Copy link
Collaborator

mrchief commented Apr 17, 2019

These are major additions, no doubt about that. But not everything is a breaking change. Another reason for releasing them separately is backward compatibility. Id-generation logic, Radio Select, ARIA, Keyboard are all backward compatible. Releasing them as v1 will make it a frictionless upgrade for anyone. And upgrading to 2.0 is not a big hurdle but it still requires some changes.

You've done a great job at sending them as separate PRs and I'd like to take advantage of that fact. I can help with this process as well.

@ellinge ellinge mentioned this pull request Apr 17, 2019
1 task
README.md Outdated Show resolved Hide resolved
@codeclimate
Copy link

codeclimate bot commented Apr 18, 2019

Code Climate has analyzed commit b1d6ef6 and detected 0 issues on this pull request.

View more on Code Climate.

@mrchief
Copy link
Collaborator

mrchief commented Apr 18, 2019

@ellinge Thanks for the quick update. You're the best! I'm gonna merge this unless you have any other changes to make. Let me know.

Copy link
Collaborator

@mrchief mrchief left a comment

Choose a reason for hiding this comment

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

Huge props for sending this!

@mrchief mrchief merged commit 85b07ea into dowjones:develop Apr 18, 2019
mrchief pushed a commit that referenced this pull request Apr 18, 2019
## What does it do?

Adds support for single select in the tree dropdown. Simple select ignores any children so this is a hybrid between the two.

Also ignores clicks for simple select when labels are disabled (only checked readonly)

The middle dropdown is radioSelect and the last one a simpleSelect
https://ellinge.github.io/react-dropdown-tree-select-test/#DevelopTemp-checkeddefault

Fixes #119 

## Type of change
- [x] Bug fix
- [x] New feature
@ellinge ellinge deleted the fix/#119 branch April 18, 2019 21:25
@mrchief
Copy link
Collaborator

mrchief commented Jun 10, 2019

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Simple select with tree view structure
3 participants