Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion uui-components/src/overlays/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export interface DropdownProps extends Partial<IEditable<boolean>> {

portalTarget?: HTMLElement;
boundaryElement?: Boundary;

closeBodyOnTogglerHidden?: boolean; // default: true; Set false if you do not want to hide the dropdown body in case Toggler is out of the viewport
}

export class Dropdown extends React.Component<DropdownProps, DropdownState> {
Expand Down Expand Up @@ -191,7 +193,7 @@ export class Dropdown extends React.Component<DropdownProps, DropdownState> {
}
};

if (isReferenceHidden && (this.state.opened || this.props.value)) {
if (isReferenceHidden && this.props.closeBodyOnTogglerHidden !== false && (this.state.opened || this.props.value)) {
// Yes, we know that it's hack and we can perform setState in render, but we don't have other way to do it in this case
setTimeout(() => { this.handleOpenedChange(false); }, 0);
return null;
Expand Down
1 change: 1 addition & 0 deletions uui-components/src/pickers/PickerInputBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export abstract class PickerInputBase<TItem, TId, TProps> extends PickerBase<TIt
onValueChange={ !this.props.isDisabled && this.toggleBodyOpening }
placement={ this.props.dropdownPlacement }
modifiers={ this.popperModifiers }
closeBodyOnTogglerHidden={ !isMobile() }
/>
);
}
Expand Down