From 17445482f813a5495a7bedfe8249732b94dfd98f Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 10 Jul 2013 13:23:11 +0000 Subject: [PATCH] * eMail/Compose: make address suggestion selectbox scrollable --- felamimail/js/jscode/composeMessage.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/felamimail/js/jscode/composeMessage.js b/felamimail/js/jscode/composeMessage.js index e382088602..4490a26025 100644 --- a/felamimail/js/jscode/composeMessage.js +++ b/felamimail/js/jscode/composeMessage.js @@ -304,6 +304,20 @@ function stopCapturingEvents() { hideResultBox(); } +function scrollIntoPosition(pos) +{ + if (typeof pos =='undefined') pos =0; + if (pos>0) pos = pos -1; + var resultBox = document.getElementById('resultBox'); + if (typeof resultBox.childNodes[pos] == 'undefined') return; + if (typeof(resultBox.childNodes[pos].scrollIntoViewIfNeeded)=='function') + { + resultBox.childNodes[selectedSuggestion].scrollIntoViewIfNeeded(true); + } else { + resultBox.childNodes[pos].scrollIntoView(true); + } +} + function keypressed(keycode, keyvalue) { if(liveSearchTimer) { window.clearTimeout(liveSearchTimer); @@ -316,8 +330,10 @@ function keypressed(keycode, keyvalue) { case KEYCODE_UP: if(selectedSuggestion > 0) { selectSuggestion(selectedSuggestion-1); + scrollIntoPosition(selectedSuggestion-1); } else { selectSuggestion(resultRows.length-1); + scrollIntoPosition(resultRows.length-1); } break; @@ -329,8 +345,10 @@ function keypressed(keycode, keyvalue) { //document.title='is selected'; if(selectedSuggestion < resultRows.length-1) { selectSuggestion(selectedSuggestion+1); + scrollIntoPosition(selectedSuggestion+1); } else { selectSuggestion(0); + scrollIntoPosition(0); } } break;