- 상태
- 미해결
- 보고된 제품
- 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);" ); }