Skip to content

Commit

Permalink
DCOS-60141: does not set position if dropdownable is not open (#422)
Browse files Browse the repository at this point in the history
DCOS-60141: does not set position if dropdownable is not open
  • Loading branch information
Daniel Schmidt committed Oct 22, 2019
2 parents 78408d6 + 1d8deee commit 52511d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
Expand Up @@ -306,7 +306,7 @@ exports[`Dropdown renders a closed dropdown 1`] = `
aria-labelledby="downshift-0-label"
class="emotion-4"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-0-menu"
role="listbox"
>
Expand Down Expand Up @@ -368,7 +368,7 @@ exports[`Dropdown renders a closed dropdown 1`] = `
aria-labelledby="downshift-0-label"
class="emotion-5"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-0-menu"
role="listbox"
>
Expand Down Expand Up @@ -430,7 +430,7 @@ exports[`Dropdown renders a closed dropdown 1`] = `
>
<Popover
aria-labelledby="downshift-0-label"
direction="bottom-right"
direction="bottom-left"
id="downshift-0-menu"
menuRef={[Function]}
role="listbox"
Expand All @@ -439,7 +439,7 @@ exports[`Dropdown renders a closed dropdown 1`] = `
aria-labelledby="downshift-0-label"
className="emotion-5"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-0-menu"
role="listbox"
style={
Expand Down Expand Up @@ -820,7 +820,7 @@ exports[`Dropdown renders a dropdown with a max height 1`] = `
aria-labelledby="downshift-0-label"
class="emotion-5"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-0-menu"
role="listbox"
>
Expand Down Expand Up @@ -992,7 +992,7 @@ exports[`Dropdown renders a dropdown with a max height 1`] = `
aria-labelledby="downshift-2-label"
class="emotion-4"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-2-menu"
role="listbox"
style="max-height: 50px;"
Expand Down Expand Up @@ -1055,7 +1055,7 @@ exports[`Dropdown renders a dropdown with a max height 1`] = `
aria-labelledby="downshift-2-label"
class="emotion-5"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-2-menu"
role="listbox"
style="max-height: 50px;"
Expand Down Expand Up @@ -1118,7 +1118,7 @@ exports[`Dropdown renders a dropdown with a max height 1`] = `
>
<Popover
aria-labelledby="downshift-2-label"
direction="bottom-right"
direction="bottom-left"
id="downshift-2-menu"
maxHeight={50}
menuRef={[Function]}
Expand All @@ -1128,7 +1128,7 @@ exports[`Dropdown renders a dropdown with a max height 1`] = `
aria-labelledby="downshift-2-label"
className="emotion-5"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-2-menu"
role="listbox"
style={
Expand Down Expand Up @@ -1509,7 +1509,7 @@ exports[`Dropdown renders an open dropdown 1`] = `
aria-labelledby="downshift-0-label"
class="emotion-5"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-0-menu"
role="listbox"
>
Expand Down Expand Up @@ -2175,7 +2175,7 @@ exports[`Dropdown renders an open dropdown with multiple sections 1`] = `
aria-labelledby="downshift-0-label"
class="emotion-9"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-0-menu"
role="listbox"
>
Expand Down Expand Up @@ -2289,7 +2289,7 @@ exports[`Dropdown renders an open dropdown with multiple sections 1`] = `
aria-labelledby="downshift-2-label"
class="emotion-9"
data-cy="popover"
direction="bottom-right"
direction="bottom-left"
id="downshift-2-menu"
role="listbox"
style="max-height: 50px;"
Expand Down
3 changes: 3 additions & 0 deletions packages/dropdownable/components/Dropdownable.tsx
Expand Up @@ -142,6 +142,9 @@ class Dropdownable extends React.Component<DropdownableProps, State> {
}

setPositionFromCurrentProps() {
if (!this.props.open) {
return;
}
this.setPosition(this.props);
}

Expand Down
8 changes: 4 additions & 4 deletions packages/tooltip/tests/__snapshots__/Tooltip.test.tsx.snap
Expand Up @@ -161,7 +161,7 @@ exports[`Tooltip renders 1`] = `
open={false}
>
<TooltipContent
direction="top-left"
direction="bottom-left"
id="renders"
open={false}
>
Expand Down Expand Up @@ -282,7 +282,8 @@ exports[`Tooltip renders open tooltip 1`] = `
<div
aria-hidden="true"
class="
emotion-0 emotion-1 inverseColorMode emotion-2"
css-nu8exu
emotion-1 inverseColorMode emotion-2"
data-cy="tooltipContent"
id="renders"
role="tooltip"
Expand Down Expand Up @@ -496,8 +497,7 @@ exports[`Tooltip renders with preferred directions 1`] = `
<div
aria-hidden="true"
class="
css-10cr3um
emotion-1 inverseColorMode emotion-2"
emotion-0 emotion-1 inverseColorMode emotion-2"
data-cy="tooltipContent"
id="renders"
role="tooltip"
Expand Down

0 comments on commit 52511d4

Please sign in to comment.