-
Notifications
You must be signed in to change notification settings - Fork 377
Feat(Options Menu): Add Options Menu Component #1814
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
Codecov Report
@@ Coverage Diff @@
## master #1814 +/- ##
==========================================
+ Coverage 82.65% 82.73% +0.07%
==========================================
Files 614 612 -2
Lines 6780 6724 -56
Branches 93 76 -17
==========================================
- Hits 5604 5563 -41
+ Misses 1136 1131 -5
+ Partials 40 30 -10
Continue to review full report at Codecov.
|
|
PatternFly-React preview: https://1814-pr-patternfly-react-patternfly.surge.sh |
|
You just had some importing errors. I fixed them for you! |
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenuToggleButton.js
Outdated
Show resolved
Hide resolved
51752e7 to
fed65af
Compare
mcarrano
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.
I see a couple of issues/questions:
-
The first example (single option) is not quite what I expected. This component would generally be used to select one option from among a list, sort options or items per page, for example. It's not the same as a multi-select. Can we change this to just be single-select? In that case the behavior will be the same as the second example, but with only one option-group.
-
In the second example, I'm noticing that the horizontal spacer between menus if different from the core example. Also that the width groups when I select the last item. Can the menu be sized so it will fit the width of all items without needing to grow/shrink to fit?
-
For the "Plain" example, not sure we need the text label. The Core example only has an icon. I guess you could use both, but it's not typical. In most cases a custom icon would be used in place of a label where we want to sane space.
Should be no problem! :)
I did see that issue - and I think that'd be a change we'd need to make in core (since I don't think we want to introduce css in the react component. I have the change locally, so I can open a PR for the change to core.
no problem :) |
Actually, the plain example is only an icon. It's the third example on the page. The last example on the page is a plain with text the same way it is in the core examples to demonstrate how someone can make their own custom toggle button using the pf-m-text modifier. Did I misunderstand some of the applications? |
|
thanks @nicolethoen!!
After those updates, you should notice the toggles will be shorter to match the height of the "Options Menu - Plain with text" example, and the icon in the "Options Menu - Plain" example will be a lighter shade of grey when not expanded.
@mcarrano if you look at the "Options Menu - Multiple options" example, and select "ascending", then select "descending", the menu width changes. You can also expand the "Options Menu - Plain" example, and click an item multiple times to select/unselect it, and the same thing happens. Should we address that somehow, or would you expect that? |
fed65af to
99e44c0
Compare
|
Okay, I've been addressing comments so far. I wanted to update so comments don't get duplicated. still left to do (as far as I'm aware):
|
Let me know if you need help with this. FWIW, the checkmarks are absolutely positioned, so even if they're in the list (and not visible), they technically don't take up/create any space. The class |
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenu.md
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenu.md
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenu.js
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenuItem.js
Outdated
Show resolved
Hide resolved
|
Hey, great job on this @nicolethoen!
Yes. In this case, having a prop named Some other comments about labels and such:
|
I have already accounted for at tab and enter, but I will also look at esc.
By this, do you mean that we should NEVER have an automatically defined aria-label or aria-labelledby on the OptionsMenuToggleButton component, and only allow the consumer to pass an ariaLabel as a prop to the OptionsMenuToggleButton component? My understanding would be that the aria-label should be used on the OptionsMenuToggleButton whenever the button has no text and only icons. |
|
Recapping what we discussed in person... For the examples labeled Options Menu - Plain and Options Menu - Plain with text (i.e. examples where the toggle button has an icon instead of text label), we will provide a default aria-label value of "Options menu". But in the Options Menu - Plain example, we will customize that text to say "Sort by" (i.e. Options Menu - Plain with text will not have For the example labeled Options Menu - Plain with text, we will change the text before the toggle to "Custom text" |
99e44c0 to
db75d72
Compare
|
Okay, I think I have addressed all PR comments made so far. a few notes:
|
db75d72 to
4f1e81b
Compare
mcarrano
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.
This is looking much better @nicolethoen . I'm still not happy about the "shimmy" effect when you select/deselect items, but the overall functionality looks right now. Agree that we can handle remaining issues as bugs to be fixed later.
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenu.md
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenuToggleWithText.d.ts
Outdated
Show resolved
Hide resolved
packages/patternfly-4/react-core/src/components/OptionsMenu/OptionsMenuToggleWithText.js
Outdated
Show resolved
Hide resolved
|
These are a couple of things that I noticed that should be fixed:
|
4f1e81b to
21fdda7
Compare
|
@jgiardino Let me know if I misunderstood any of the above comments. I believe I've addressed them now :) |
|
Can we update the
|
21fdda7 to
82be5b9
Compare
dlabaj
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.
LGTM
|
Your updates are great! All the props work as expected! I just noted below a couple of minor refinements, like changes to default text strings and what props we define on the examples.
|
82be5b9 to
8c82a98
Compare
| /** Content to be rendered in the Options menu toggle button */ | ||
| toggleTemplate: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), | ||
| /** Props to be passed to the Options menu toggle button template */ | ||
| templateProps: PropTypes.object, |
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.
Small nit. Can we call this toggleTemplateProps so the name is more meaningful. Up to you if you want to chnage it or not.
changing to comment since it it optional change.
8c82a98 to
0acef8c
Compare
|
@tlabaj should be all set! |
tlabaj
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.
LGTM
tlabaj
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.
LGTM


Addresses Issue 1288