elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.
https://elementor.com/
GNU General Public License v3.0
6.42k stars 1.39k forks source link

elementorFrontend.init() create duplicates of .sub-arrow (Wordpress Menu widget) #27208

Open vladninja opened 2 weeks ago

vladninja commented 2 weeks ago

Prerequisites

Description

When I am calling the elementorFrontend.init() method to reinit the Elementor scripts in some places, that cause a problem with a Wordpress Menu widget with the language dropdown option. image

As a workaround I am currently using a JS script which I am running after the calling init method.

let menus = jQuery('ul[data-smartmenus-id] .elementor-nav-menu--dropdown')
  jQuery.each(menus, function(index, item) {
    jQuery(item).closest('[data-smartmenus-id]').smartmenus('refresh')
  })

I am found the refresh method on the smartmenus library and it seems work as expected.

Steps to reproduce

  1. Create a Wordpress menu with a Language menu Item (I am using Polylang) image
  2. Add the Wordpress Menu widget to the Header Elementor template (horizontal layout)
  3. On any of the pages call elementorFrontend.init()
  4. The .sub-arrow will be added multiple times
  5. image

Expected behavior

After calling the elementorFrontend.init() the .sub-arrow not be duplicated

Isolating the problem

Elementor System Info

== Server Environment ==
    Operating System: Linux
    Software: Apache/2.4.54 (Debian)
    MySQL version: MySQL Community Server - GPL v8.0.31
    PHP Version: 7.4.33
    PHP Memory Limit: 256M
    PHP Max Input Vars: 1000
    PHP Max Post Size: 8M
    GD Installed: No
    ZIP Installed: Yes
    Write Permissions: All right
    Elementor Library: Connected

== WordPress Environment ==
    Version: 6.2.4
    Site URL: http://localhost:8083
    Home URL: http://localhost:8083
    WP Multisite: No
    Max Upload Size: 2 MB
    Memory limit: 40M
    Max Memory limit: 256M
    Permalink Structure: /%postname%/
    Language: en_US
    Timezone: 0
    Admin Email: wwww@0pppp.com
    Debug Mode: Active

== Theme ==
    Name: Hello Elementor
    Version: 2.7.1
    Author: Elementor Team
    Child Theme: No

== User ==
    Role: administrator
    WP Profile lang: en-US
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

== Active Plugins ==
    Elementor
        Version: 3.20.2
        Author: Elementor.com

    Elementor Pro
        Version: 3.20.1
        Author: Elementor.com

== Features ==
    Custom Fonts: 0
    Custom Icons: 1

== Integrations ==

== Elementor Experiments ==
    Improved Asset Loading: Active
    Improved CSS Loading: Active
    Inline Font Icons: Active
    Additional Custom Breakpoints: Active
    admin_menu_rearrangement: Inactive by default
    Flexbox Container: Active
    Upgrade Swiper Library: Active
    Grid Container: Active
    Default to New Theme Builder: Active
    Hello Theme Header & Footer: Active
    Editor Top Bar: Inactive
    Optimized Gutenberg Loading: Active by default
    Build with AI: Active by default
    Landing Pages: Active
    Nested Elements: Active
    Lazy Load Background Images: Active
    Optimize Image Loading: Active by default
    Notes: Active
    Display Conditions: Active
    Form Submissions: Active
    Menu: Active
    Taxonomy Filter: Inactive by default

== Log ==

== Elementor - Compatibility Tag ==

    Elementor Pro: Compatibility not specified

== Elementor Pro - Compatibility Tag ==

Agreement