question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown-panel size issue

See original GitHub issue

When using the generic Dropdown panel pattern (https://www.patternfly.org/v4/documentation/react/components/dropdown/#dropdown-panel), it is possible to place arbitrary content in the panel:

image

At some point, the generated markup of Dropdown changed to remove ul DOM nodes, which is fine. However, there is an issue that is causing the panel of the dropdown to limit it’s size to the width of the dropdown. Previously, the width of the panel increased as needed (similarly the other patterns). This generates issues when the panel’s content needs a larger width:

image

For now, to workaround the issue I’m adding an additional layer with a className="pf-c-dropdown__menu-item" like the following (which I formed by looking at the markup of older react-core versions):

<Dropdown
    onSelect={this.onSelect}
    toggle={<DropdownToggle onToggle={this.onToggle}>Expanded Dropdown</DropdownToggle>}
    isOpen={isOpen}
    >
    <div className="pf-c-dropdown__menu-item">
        [Panel contents here]
    </div>
</Dropdown>

and this workaround fixes the sizing issue:

image

But I think the “generic Dropdown” pattern should generate the required markup to avoid this workaround and to behave the same as the other patterns.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mcokercommented, Oct 18, 2019

@israel-hdez it looks like this use case might be better as an OptionsMenu or Select component? The dropdown should only handle links or actions.

Even with a custom menu, it’s still advised to use the .pf-c-[select/options-menu/dropdown]--menu-item class on your items so that you retain the PF styles (layout, spacing, hover/focus states). You can see an example of your general layout using the select component here - https://www.patternfly.org/v4/documentation/react/components/select/#grouped-checkbox-select-input

0reactions
mcarranocommented, Dec 13, 2019

@israel-hdez I’ve opened a new issue here to track the request to make the badge optional: https://github.com/patternfly/patternfly-next/issues/2519 Will close this one out,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adjust the size of the dropdown menu · Issue #939 · ng-select ...
Describe the bug I´d like to adjust the width of dropdown. The dropdown menu has the same width of his parent. Reproducbile example....
Read more >
How to reduce the size of MatSelect DropDown Panel
You can set the width of mat-select by adding the below css to the main styles.css file. .mat-form-field-infix{ width: 80px !important; }.
Read more >
Having an issue with dropdown width to stretch dropdown width
In order to achieve full width dropdowns, you need to have a full width menu navbar. Dropdowns cannot extend width of navbar. Menu...
Read more >
ngSelect Customizations: Draggable Panel - ActiveLAMP
Using the resized class added above when the user has made the panel dropdown taller, gives the opportunity to set the panel options...
Read more >
Dropdown | Foundation for Sites 6 Docs
Basics. To create a dropdown pane, add the class .dropdown-pane and the attribute data-dropdown to an element. Give the dropdown a unique ID...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found