- Status
- Aberto
- Relatado para
- WPML Multilingual CMS 4.6.11
- Tags de tópico
- Bug
Visão geral do problema
Se você estiver usando o bloco Seletor de idiomas do Gutenberg e sua opção Dropdown click, você notará que, ao clicar fora da área do menu suspenso, ele não fechará como esperado.
Solução alternativa
Por favor, certifique-se de fazer um backup completo do seu site antes de prosseguir.
- Abra o arquivo …/wp-content/plugins/sitepress-multilingual-cms/classes/block-editor/Blocks/LanguageSwitcher/Render.php.
- Procure a linha 123.
- Substitua:
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);" ); }