Skip to content

Dropdown: Popover content is wrong positioned #8559

Description

@mmtr

Describe the bug
When rendering a Dropdown component outside Gutenberg, the popover content is wrong positioned.

To Reproduce
Execute the code below in a new React project after installing @wordpress/components.

import React from 'react';
import ReactDOM from 'react-dom';
import { Button, Dropdown } from '@wordpress/components';

import '@wordpress/components/build-style/styles.css';

const MyDropdown = () => (
	<Dropdown
		position="bottom right"
		renderToggle={ ( { isOpen, onToggle } ) => (
			<Button isPrimary onClick={ onToggle } aria-expanded={ isOpen }>
				Toggle Popover!
			</Button>
		) }
		renderContent={ () => (
			<div>
				This is the content of the popover.
			</div>
		) }
	/>
);

ReactDOM.render(
	<MyDropdown />,
	document.getElementById( 'root' )
);

Expected behavior
The popover content should be displayed below the button.

Screenshots
screen shot 2018-08-05 at 22 49 24

Desktop:

  • OS: macOS High Sierra
  • Browser Chrome
  • Version 67

Additional context
Issue found while working on #8338 and Automattic/wp-calypso#26367

Metadata

Metadata

Assignees

Labels

Good First IssueAn issue that's suitable for someone looking to contribute for the first timeNeeds DevReady for, and needs developer efforts[Feature] UI ComponentsImpacts or related to the UI component system[Package] Components/packages/components[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions