메뉴 여닫기
환경 설정 메뉴 여닫기
개인 메뉴 여닫기
로그인하지 않음
만약 지금 편집한다면 당신의 IP 주소가 공개될 수 있습니다.

미디어위키:Common.js: 두 판 사이의 차이

novawiki
(새 문서: →‎이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다.: →‎* * Autofocus search input on mobile * Triggered when MobileFrontend search UI opens * Improves UX by immediately opening the virtual keyboard: mw.hook('mobileFrontend.search.open').add(function () { setTimeout(function () { const input = document.querySelector('.citizen-search__input') || document.querySelector('#searchInput') ||...)
 
편집 요약 없음
7번째 줄: 7번째 줄:
  */
  */
mw.hook('mobileFrontend.search.open').add(function () {
mw.hook('mobileFrontend.search.open').add(function () {
     setTimeout(function () {
     const tryFocus = () => {
         const input =
         const input =
             document.querySelector('.citizen-search__input') ||
             document.querySelector('.citizen-search__input') ||
14번째 줄: 14번째 줄:


         if (input) {
         if (input) {
             input.focus();
             input.focus({ preventScroll: true });
            input.click(); // 모바일에서 키보드 트리거에 도움 될 때가 있음
         }
         }
     }, 150);
     };
 
    requestAnimationFrame(() => requestAnimationFrame(tryFocus));
});
});

2026년 1월 17일 (토) 18:33 판

/* 이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다. */

/**
 * Autofocus search input on mobile
 * Triggered when MobileFrontend search UI opens
 * Improves UX by immediately opening the virtual keyboard
 */
mw.hook('mobileFrontend.search.open').add(function () {
    const tryFocus = () => {
        const input =
            document.querySelector('.citizen-search__input') ||
            document.querySelector('#searchInput') ||
            document.querySelector('input[type="search"]');

        if (input) {
            input.focus({ preventScroll: true });
            input.click(); // 모바일에서 키보드 트리거에 도움 될 때가 있음
        }
    };

    requestAnimationFrame(() => requestAnimationFrame(tryFocus));
});