-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
For the dropdown component, the max-height style attribute is placed on the p-dropdown-items-wrapper element, which makes it impossible to override either by classname or by props to the Dropdown component.
Similar to the way the AutoComplete component is structured, this style attribute should be placed on the p-dropdown-panel element so that it can be overridden by use of the panelStyle prop for the DropDown component.
As it stands, there appears to be no way to affect the styles applied to p-dropdown-items-wrapper, so the height of the dropdown panel cannot be changed either by the props to DropDown, or via classnames on the theme.
As pointed out above, the max-height for the AutoCompleter panel is placed on p-autocomplete-panel element, where is can be overridden by the panelStyle prop; Dropdown should be similarly structured.
Reproducer
No response
PrimeReact version
9.2.3
React version
18.x
Language
TypeScript
Build / Runtime
Next.js
Browser(s)
all browsers
Steps to reproduce the behavior
- Create a Dropdown element.
- Use the
panelStyleprop to set a custommax-heightattribute (in the example code below, '400px'). - Inspect the panel structure and see that while the custom
max-heightis correctly placed on thep-dropdown-panelelement, it is overridden by amax-heightattribute on thep-dropdown-items-wrapperelement, making it impossible to affect.
<div
class="p-dropdown-panel p-component p-ripple-disabled p-connected-overlay-enter-done"
style="max-height: 400px; z-index: 1001; min-width: 171px; transform-origin: center top; top: 436.562px; left: 16px;"
>
<div class="p-dropdown-items-wrapper" style="max-height: 200px;">
<ul class="p-dropdown-items" role="listbox">
...
Expected behavior
Similarly to the way the AutoCompleter component places the max-height on the p-autocomplete-panel element where it can be overridden via the panelStyle prop, the max-height for the DropDown element should be placed on the p-dropdown-panel element so that it may be overridden via the DropDown's panelStyle.