WPML
Trạng thái
Đang mở
Được báo cáo cho
WPML Multilingual CMS 4.6.11
Thẻ chủ đề
Bug

Tổng quan về lỗi

Nếu bạn đang sử dụng khối Gutenberg Bộ chuyển đổi ngôn ngữ và tùy chọn Nhấp vào menu thả xuống của nó, bạn sẽ nhận thấy rằng khi nhấp ra ngoài khu vực menu thả xuống, nó sẽ không đóng lại như mong đợi.

Giải pháp tạm thời

Đảm bảo bạn có bản sao lưu toàn bộ trang web trước khi tiếp tục.


  • Mở tệp …/wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/Blocks/LanguageSwitcher/Render.php.

  • Tìm dòng 123.

  • Thay thế:
    				if ( $dpFirstItem ) {
    					$dpFirstItem->setAttribute(
    						'onclick',
    						"(()=>{const ariaExpanded = this.children[0].getAttribute('aria-expanded');
    					this.children[0].setAttribute('aria-expanded', ariaExpanded === 'true' ? 'false' : 'true');})(this);"
    					);
    				}

  • Bằng:
    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);"
        );
    }

Tất cả các lỗi đã ghi nhận →