import React from 'react'; import { Modal, ModalVariant, Button, Dropdown, DropdownToggle, DropdownItem } from '@patternfly/react-core'; import CaretDownIcon from '@patternfly/react-icons/dist/esm/icons/caret-down-icon'; export const ModalWithDropdown: React.FunctionComponent = () => { const [isModalOpen, setIsModalOpen] = React.useState(false); const [isDropdownOpen, setIsDropdownOpen] = React.useState(false); const handleModalToggle = () => { setIsModalOpen(!isModalOpen); setIsDropdownOpen(false); }; const handleDropdownToggle = (isDropdownOpen: boolean) => { setIsDropdownOpen(isDropdownOpen); }; const onSelect = () => { setIsDropdownOpen(!isDropdownOpen); onFocus(); }; const onFocus = () => { const element = document.getElementById('modal-dropdown-toggle'); (element as HTMLElement).focus(); }; const onEscapePress = () => { if (isDropdownOpen) { setIsDropdownOpen(!isDropdownOpen); onFocus(); } else { handleModalToggle(); } }; const dropdownItems = [ Link, Action , Disabled Link , Disabled Action ]; return ( Confirm , ]} onEscapePress={onEscapePress} >
Set the dropdown menuAppendTo prop to parent in order to allow the dropdown menu break out of the modal container. You'll also want to handle closing of the modal yourself, by listening to the onEscapePress callback on the Modal component, so you can close the Dropdown first if it's open without closing the entire modal.

Dropdown with a menu that can break out } isOpen={isDropdownOpen} dropdownItems={dropdownItems} menuAppendTo="parent" />
); };