import React from 'react'; import { Modal, ModalVariant, Button, Dropdown, DropdownList, DropdownItem, MenuToggle, MenuToggleElement } from '@breakaway/preact-core'; export const ModalWithDropdown: React.FunctionComponent = () => { const [isModalOpen, setIsModalOpen] = React.useState(false); const [isDropdownOpen, setIsDropdownOpen] = React.useState(false); const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => { setIsModalOpen(!isModalOpen); setIsDropdownOpen(false); }; const handleDropdownToggle = () => { setIsDropdownOpen(!isDropdownOpen); }; const onSelect = () => { setIsDropdownOpen(!isDropdownOpen); onFocus(); }; const onFocus = () => { const element = document.getElementById('modal-dropdown-toggle'); (element as HTMLElement).focus(); }; const onEscapePress = (event: KeyboardEvent) => { if (isDropdownOpen) { setIsDropdownOpen(!isDropdownOpen); onFocus(); } else { handleModalToggle(event); } }; 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.

setIsDropdownOpen(isOpen)} toggle={(toggleRef: React.Ref) => ( Dropdown )} > Action ev.preventDefault()} > Link Disabled Action Disabled Link
); };