i'm stupid
This commit is contained in:
parent
31e3e8539a
commit
dd26945084
|
@ -29,11 +29,11 @@ const searchTemplate = (journeysHistory) => html`
|
|||
<h1>Öffisearch</h1>
|
||||
</div>
|
||||
<label for="from">${t('from')}:</label>
|
||||
<input type="text" name="from" id="from" placeholder="${t('from')}" value="${fromValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keydown=${onKeypress} required>
|
||||
<input type="text" name="from" id="from" placeholder="${t('from')}" value="${fromValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keyup=${onKeyup} @keydown=${onKeydown} required>
|
||||
<div class="suggestions" id="fromSuggestions"></div>
|
||||
|
||||
<label for="to">${t('to')}:</label>
|
||||
<input type="text" name="to" id="to" placeholder="${t('to')}" value="${toValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keydown=${onKeypress} required>
|
||||
<input type="text" name="to" id="to" placeholder="${t('to')}" value="${toValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keyup=${onKeyup} @keydown=${onKeydown} required>
|
||||
<div class="suggestions" id="toSuggestions"></div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -410,7 +410,7 @@ const stopMouseOverSuggestions = (e) => {
|
|||
el.classList.remove('mouseover');
|
||||
};
|
||||
|
||||
const onKeypress = (e) => {
|
||||
const onKeyup = (e) => {
|
||||
let which = e.which || e.keyCode;
|
||||
|
||||
let forbiddeKeys = [13, 38, 40];
|
||||
|
@ -418,6 +418,11 @@ const onKeypress = (e) => {
|
|||
if (!forbiddeKeys.includes(which)) {
|
||||
loadSuggestions(e, e.target.id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const onKeydown = (e) => {
|
||||
let which = e.which || e.keyCode;
|
||||
|
||||
if (which == 13) { // enter
|
||||
if (!ElementById('selected')) {
|
||||
|
|
Loading…
Reference in a new issue