Add the ability to use custom props for the panel used to render options#4438
Conversation
| * Custom properties for ISelectableDroppableText's Panel used to render options on small devices. | ||
| */ | ||
| panelProps?: IPanelProps; | ||
|
|
There was a problem hiding this comment.
Can you explain why panelProps needs to be added to this types file?
There was a problem hiding this comment.
The dropdown component renders a callout for a normal sized device, and a panel for small devices. Inside calloutProps, there's a field for specifying focustrapprops (and inside that, we can set the field forcefocusinsidetrap to be false). By setting these fields, we can click "outside" (ie, past the first page of items) and not have the focus forced to the top of the dropdown list. We need the ability to set these same props for the mobile implementation, since when the dropdown is rendered on mobile, it's a panel.
There was a problem hiding this comment.
I understand that panelProps only apply to Dropdown component (when rendered in small devices), and SelectableDroppableText.types.ts factors out common props to both Dropdown and ComboBox component. However, because SelectableDroppableText.types.ts already contains calloutProps I though it was confusing to devs to find panelProps on a different file. Moreover, eventually ComboBox could benefit of the same behavior dropdown has today for small devices. Let me know your thoughts, thanks!
| ( | ||
| <Panel | ||
| className={ css('ms-Dropdown-panel', styles.panel) } | ||
| className={ css('ms-Dropdown-panel', styles.panel, panelProps ? panelProps.className : undefined) } |
There was a problem hiding this comment.
!!panelProps && panelProps.className instead of a ternary should work fine.
There was a problem hiding this comment.
Hi,
I followed the style implied on line 378:
className={ css('ms-Dropdown-callout', styles.callout, calloutProps ? calloutProps.className : undefined) }
Functionally its the same thing, let me know if you want me to change both.
There was a problem hiding this comment.
I'd say we're moving away from the ternaries unless the 3rd option is actually valuable.
There was a problem hiding this comment.
Cool. I will update both then. What about the other comment? any other concerns before I update?
There was a problem hiding this comment.
Looks great to me. I approved
e1aa2ae to
c20b178
Compare
…ons on small devices. This change follows the precedent of calloutProps used for rendering options on other devices.
c20b178 to
ef48261
Compare
|
@micahgodbolt anything else required to merge? Thanks! |
Add the ability to use custom props for the panel used to render options on small devices.
This change follows the precedent of calloutProps used for rendering options on other devices.
Pull request checklist
$ npm run change