Skip to content

Commit

Permalink
[EuiContextMenu] Fix post-transition unclickable menu items (#3656)
Browse files Browse the repository at this point in the history
* remove comma causing prop type warnings

* move transition flag to be fully controlled by parent state

* CL
  • Loading branch information
thompsongl authored Jun 25, 2020
1 parent 748d047 commit 70aa5fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

- Added `gutterSize` prop to `EuiFacetGroup` ([#3639](https://github.com/elastic/eui/pull/3639))

**Bug fixes**

- Fixed `EuiContextMenu` panel `onAnimationEnd` transition bug in Chrome ([#3656](https://github.com/elastic/eui/pull/3656))

## [`26.1.0`](https://github.com/elastic/eui/tree/v26.1.0)

- Optimized in-memory datagrid mount performance ([#3628](https://github.com/elastic/eui/pull/3628))
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export default () => {
window.alert('Permalinks');
},
},
,
],
},
{
Expand Down
18 changes: 3 additions & 15 deletions src/components/context_menu/context_menu_panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ interface State {
items: Props['items'];
};
menuItems: HTMLElement[];
isTransitioning: boolean;
focusedItemIndex?: number;
currentHeight?: number;
height?: number;
Expand All @@ -104,7 +103,6 @@ export class EuiContextMenuPanel extends Component<Props, State> {
items: this.props.items,
},
menuItems: [],
isTransitioning: Boolean(props.transitionType),
focusedItemIndex: props.initialFocusedItemIndex,
currentHeight: undefined,
};
Expand Down Expand Up @@ -226,7 +224,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {

// Setting focus while transitioning causes the animation to glitch, so we have to wait
// until it's finished before we focus anything.
if (this.state.isTransitioning) {
if (this.props.transitionType) {
return;
}

Expand Down Expand Up @@ -261,10 +259,6 @@ export class EuiContextMenuPanel extends Component<Props, State> {
}

onTransitionComplete = () => {
this.setState({
isTransitioning: false,
});

if (this.props.onTransitionComplete) {
this.props.onTransitionComplete();
}
Expand Down Expand Up @@ -293,11 +287,6 @@ export class EuiContextMenuPanel extends Component<Props, State> {
nextState.prevProps = { items: nextProps.items };
}

if (nextProps.transitionType) {
needsUpdate = true;
nextState.isTransitioning = true;
}

if (needsUpdate) {
return nextState;
}
Expand Down Expand Up @@ -349,7 +338,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {
return true;
}

if (nextState.isTransitioning !== this.state.isTransitioning) {
if (nextProps.transitionType !== this.props.transitionType) {
return true;
}

Expand Down Expand Up @@ -470,8 +459,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {
const classes = classNames(
'euiContextMenuPanel',
className,
this.state.isTransitioning &&
transitionDirection &&
transitionDirection &&
transitionType &&
transitionDirectionAndTypeToClassNameMap[transitionDirection]
? transitionDirectionAndTypeToClassNameMap[transitionDirection][
Expand Down

0 comments on commit 70aa5fc

Please sign in to comment.