ElemeFE / ElemeFE/element

[Bug Report] El-submenu causes 'Maximum call stack exceeded' error in collapsed menu if it's the top element of a component

Open
#17,960 15 comments 32 reactions 0 assignees View on GitHub
type: bug
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

### Element UI version
2.12.0

### OS/Browsers version
Windows 10 OS Version 1809 (Build 17763.805) / 78.0.3904.70 (Official Build) (64-bit) (cohort: 78_70_Win)

### Vue version
2.6.10

### Reproduction Link
https://codepen.io/mik-jozef-artin/pen/abbYNza

### Steps to reproduce
0. Open the [reproduction link](https://codepen.io/mik-jozef-artin/pen/abbYNza).
1. Place mouse on the menu (ie. the text 'title')

The error 'Maximum call stack size exceeded' will appear in the console.

It seems to me that these conditions are all necessary for the issue to manifest:

0. Menu must be collapsed (the `collapse` prop on `el-menu` must be `true`)
1. Submenu must be in a separate component (in this case `customized-menu-item`)
2. The submenu must be the top element in the separate component.
3. Attribute `:popper-append-to-body="true"` must be present on the submenu

Fortunately, the second condition provides an **easy workaround** - placing the submenu inside a `div`
will suppress the issue. This behavior is still surprising and I guess unwanted.

### What is Expected?
No errors.

### What is actually happening?
`Uncaught RangeError: Maximum call stack size exceeded.`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked CodePen reproduction and inspect the collapsed el-menu containing the top-level el-submenu, especially with popper-append-to-body enabled. Trace the hover path that produces the maximum call stack error and compare it with the div-wrapped workaround. Done means the reproduction no longer logs the error while preserving the collapsed submenu behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.