-
Notifications
You must be signed in to change notification settings - Fork 376
feat(ContextSelector): Add PF4 ContextSelector Component #1526
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
Conversation
|
PatternFly-React preview: https://1526-pr-patternfly-react-patternfly.surge.sh |
|
One thing I noticed is that during a search, if I enter a lowercase "a", it returns nothing. Should the search be case-insensitive for this component? The component isn't keyboard accessible at the moment. For the first implementation, I think the simplest solution is to handle the panel similar to how we handle the popover or modal with regard to trapping and managing focus.
|
|
@jgiardino the application implements the search functionality. I can change the example to be case insensitive if you would like. Not sure what I changed. I added the focus trap similar to popover like we talked about... I will have to investigate and figure out what is going on. |
|
Thanks, @tlabaj!
I'm not sure what the general expectation is here. That makes sense that we would be more hands-off and rely on consumers to handle that functionality. But I could also see the case where consumers would want to see an example that shows how we would recommend handling that functionality. 🤷♀️ I will totally defer to anyone who has a strong opinion about that.
One thing you might want to check is whether there is anything else in the component that might be managing focus, and remove that. E.g. if you included some of the keyboard navigation for the menu, maybe there's a conflict there. |
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelector.js
Outdated
Show resolved
Hide resolved
|
Also noticed what Jen mentioned, it looks like the search is case sensitive at the moment. Additionally, if you backspace out some characters (Aw > A > AW to search AWS, or Opens > Open > OpenS to search OpenShift) to correct the case it doesn't look like it re-searches, you have to back out the entire string. When the list is filtered by the text search and you click to select the item, it looks like it is selecting based on the current index for that filtered list, so it selects the wrong item based on the whole refCollection. |
Codecov Report
@@ Coverage Diff @@
## master #1526 +/- ##
==========================================
- Coverage 83.05% 82.89% -0.16%
==========================================
Files 568 573 +5
Lines 6184 6249 +65
Branches 75 75
==========================================
+ Hits 5136 5180 +44
- Misses 1018 1039 +21
Partials 30 30
Continue to review full report at Codecov.
|
bba5a8f to
aeb3a56
Compare
christiemolloy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Titani this looks spot on! Was wondering if you could add some more items to the list in the menu, feel free to just repeat the info that is already there like I did in Core. We want to show the scroll functionality
jschuler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! mostly just some minor comments
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelector.js
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelector.js
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,12 @@ | |||
| import { FunctionComponent, HTMLProps, ReactType } from 'react'; | |||
|
|
|||
| export interface ContextSelectorItemProps extends HTMLProps<HTMLAnchorElement> { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The props are spread to a button element, so should probably be HTMLButtonElement
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelectorItem.d.ts
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelectorItem.d.ts
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelectorItem.js
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelectorItem.js
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/ContextSelector/ContextSelectorToggle.js
Outdated
Show resolved
Hide resolved
| className | ||
| )} | ||
| type="button" | ||
| onClick={_event => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| onClick={_event => { | |
| onClick={() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I passed the event incase the consumer may want to look at it.
christiemolloy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSS looks great
|
@mcarrano should we have an example where you type in the search input, click the search icon and then it searches vs the implementation here where it automatically searches - it just seems as though the button is redundant, and I wanted to get your input on it. |
👍 I agree, it would be nice to test this in the context of the demo.
I would say that change could be a separate issue, and that we address it in core first. I wouldn't hold this PR up for that since it's not a bug, just a refinement. I just reviewed this again. The issue I noted with handling Enter key on the toggle is fixed, which is awesome! I tested in JAWS to see if adding Considering the differences between popover (which uses tippy) and modal, I wonder if tippy would be our best option for this component. Both require separating the popup element from the Other than that, there are just a couple of more things I noticed that would be simple updates:
|
|
Issue #1615 has been opened and will address remaining accessibility concerns. |
|
@jgiardino @mcarrano Is enter after typing in search suppose to select the first item in the dropdown from the search results? |
|
IMO button does not make sense if you use typeahead select |
jgiardino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest updates look good to me. Thanks!
#1293, #1525
What:
Additional issues: