- Estado
- Abierto
- Notificado para
- WPML Multilingual CMS 4.6.11
- Etiquetas de temática
- Bug
Resumen del problema
Si utiliza el bloque Selector de idiomas de Gutenberg y su opción Clic en el desplegable, notará que al hacer clic fuera del área desplegable, no se cerrará como se espera.
Solución alternativa
Asegúrese de tener una copia de seguridad completa de su sitio antes de continuar.
- Abra el archivo …/wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/Blocks/LanguageSwitcher/Render.php.
- Busque la línea 123.
- Reemplace:
if ( $dpFirstItem ) { $dpFirstItem->setAttribute( 'onclick', "(()=>{const ariaExpanded = this.children[0].getAttribute('aria-expanded'); this.children[0].setAttribute('aria-expanded', ariaExpanded === 'true' ? 'false' : 'true');})(this);" ); } - Por:
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);" ); }