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

fix(select): disable focus trap on checkbox select with no children #2647

Merged
merged 1 commit into from Aug 8, 2019

Conversation

@boaz0
Copy link
Member

boaz0 commented Aug 5, 2019

What:

It seems like Focus Trap throws exception if no children to ref. In order to avoid this error, render the component with no Focus Trap when no children is passed.

closes #2618

//cc @SpyTec

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Aug 5, 2019

PatternFly-React preview: https://patternfly-react-pr-2647.surge.sh

@jenny-s51

This comment has been minimized.

Copy link
Contributor

jenny-s51 commented Aug 6, 2019

Hi @boaz0, your changes look great! When I set the select dropdown to have no children (delete the options object from CheckboxSelectInput), the focus trap error no longer appears. However, if I try to expand it looks like this.
ezgif com-video-to-gif(1)

I'm wondering what should be the default behavior of the select dropdown if there are no children. Though it's also possible that I'm not testing it like you did... how did you test your changes?

@jenny-s51 jenny-s51 self-requested a review Aug 6, 2019
@SpyTec

This comment has been minimized.

Copy link
Contributor

SpyTec commented Aug 6, 2019

Hi @jenny-s51, I would say that issue is out of scope for this PR. The behavior exists on all select components so it's probably better suited for patternfly-next

@jenny-s51

This comment has been minimized.

Copy link
Contributor

jenny-s51 commented Aug 6, 2019

@SpyTec Makes sense to me -- thank you for clarifying Eric!

Copy link
Contributor

jenny-s51 left a comment

LGTM 👍

@boaz0

This comment has been minimized.

Copy link
Member Author

boaz0 commented Aug 6, 2019

@jenny-s51 sorry for the late response. I actually thought an empty div is an expected behavior. Though, I agree with @SpyTec when he said we should ask the pf4 core team what they think about it.

//cc @mcoker @mcarrano - can you take a look at this. What should the expanded select item look like when there are no children/options?

@mcarrano

This comment has been minimized.

Copy link
Member

mcarrano commented Aug 6, 2019

Can you give me an example use case of how/where this would show up?

@jenny-s51

This comment has been minimized.

Copy link
Contributor

jenny-s51 commented Aug 7, 2019

Yes @mcarrano please see patternfly/patternfly-next#2132 (comment) for @SpyTec 's response to your question

@mceledonia

This comment has been minimized.

Copy link

mceledonia commented Aug 7, 2019

Chiming in here (I think a typo led me here) but I'd think just a basic text-only empty state, maybe secondary text color body style "No options available" or some similar language would work! Same spacing as a single entry in the list... nothing too fancy needed. Scratch that, I was thinking this was for just a dropdown with no options available vs. none yet loaded.

@jschuler

This comment has been minimized.

Copy link
Collaborator

jschuler commented Aug 8, 2019

This fixes an bug that is already present (throws an exception if no children present), merging this and in the meantime we can explore a loading pattern/skeleton for when there are no children in patternfly/patternfly-next#2132

@jschuler jschuler merged commit f5f6ab6 into patternfly:master Aug 8, 2019
8 checks passed
8 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: build_integration Your tests passed on CircleCI!
Details
ci/circleci: build_pf3_docs Your tests passed on CircleCI!
Details
ci/circleci: build_pf4_docs Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: test_jest_other Your tests passed on CircleCI!
Details
ci/circleci: test_jest_pf4 Your tests passed on CircleCI!
Details
ci/circleci: upload_docs Your tests passed on CircleCI!
Details
@boaz0 boaz0 deleted the boaz0:closes_2618 branch Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.