안드로이드 키보드에서 단어 제안이 켜져있을 때, 값이 텍스트 필드로 전송 되더라도 Firefox는 키보드가 단어를 추측하는 동안 키 이벤트를 트리거하지 않습니다. 나는 이것이 Firefox의 버그라고 말하지만, 키보드의 결과가 여러분이 작성한 정확한 것 이외의 다른 것을 제안한다면 필드의 값과 일관성이 없기 때문에이 방법을 선택했을 것입니다.
변경된 값을 확인하는 스니퍼를 사용하여이 문제를 해결했습니다.
var $searchField;
var _keypressWatchingTimer = 0;
var _previousTerm = '';
function keypressStartWatching() {
keypressStopWatching();
_keypressWatchingTimer = setInterval(executeAutocomplete, 100);
}
function keypressStopWatching() {
if (_keypressWatchingTimer != 0) {
clearInterval(_keypressWatchingTimer);
_keypressWatchingTimer = 0;
}
}
function executeAutocomplete() {
var searchTerm = $searchField.val() || '';
if (_previousTerm == searchTerm)
return false;
searchApi.autocomplete(searchTerm);
_previousTerm = searchTerm;
}
function init() {
$searchField = $('#searchField')
.focus(keypressStartWatching)
.blur(keypressStopWatching)
.keyup(executeAutocomplete);
}
init();
출처
2013-01-08 09:47:37
awe
이 프로젝트는 FF 지원없이 완료되었지만이 답변은 합리적인 것으로 받아 들일 것입니다. – row1