WPML
סטטוס
פתוח
דווח עבור
WPML Multilingual CMS 4.6.11
תגיות נושא
Bug

סקירה כללית של התקלה

אם אתה משתמש בבלוק Gutenberg של בורר השפות ובאפשרות לחיצה על תפריט נפתח שלו, תבחין שבעת לחיצה מחוץ לאזור התפריט הנפתח, הוא לא ייסגר כצפוי.

פתרון עוקף

אנא ודא שיש לך גיבוי מלא של האתר לפני שתמשיך.


  • פתח את הקובץ …/wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/Blocks/LanguageSwitcher/Render.php.

  • חפש את שורה 123.

  • החלף את:
    				if ( $dpFirstItem ) {
    					$dpFirstItem->setAttribute(
    						'onclick',
    						"(()=>{const ariaExpanded = this.children[0].getAttribute('aria-expanded');
    					this.children[0].setAttribute('aria-expanded', ariaExpanded === 'true' ? 'false' : 'true');})(this);"
    					);
    				}

  • ב:
    if ($dpFirstItem) {
        $dpFirstItem->setAttribute(
            'onclick',
            "(()=>{
                const ariaExpanded = this.children[0].getAttribute('aria-expanded');
                this.children[0].setAttribute('aria-expanded', ariaExpanded === 'true' ? 'false' : 'true');
                
                if (ariaExpanded !== 'true') {
                    const expandedItem = this;
                    const closeExpandedItem = (event) => {
                        if (!expandedItem.contains(event.target)) {
                            expandedItem.children[0].setAttribute('aria-expanded', 'false');
                            document.removeEventListener('click', closeExpandedItem);
                        }
                    };
                    document.addEventListener('click', closeExpandedItem);
                }
            })(this);"
        );
    }

כל התקלות הידועות →