Skip to content

Commit

Permalink
Fix Mobile Key Event Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed Apr 5, 2022
1 parent 6923b03 commit 6f4688f
Show file tree
Hide file tree
Showing 6 changed files with 1,274 additions and 6 deletions.
26 changes: 25 additions & 1 deletion .github/factory/index.js.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,13 @@ function OP(source, state = {}) {
}
} else {
setHTML(selectBoxFakeInputPlaceholder, ZERO_WIDTH_SPACE);
if (valuePrev !== (value = toCaseLower(value)) && KEY_ARROW_DOWN !== key && KEY_ARROW_UP !== key) {
if (valuePrev !== (value = toCaseLower(value)) && (
KEY_ARROW_DOWN !== key &&
KEY_ARROW_LEFT !== key &&
KEY_ARROW_RIGHT !== key &&
KEY_ARROW_UP !== key &&
KEY_ENTER !== key
)) {
for (let i = 0, j = toCount(selectBoxFakeOptions), v; i < j; ++i) {
letOptionSelected((selectBoxFakeOption = selectBoxFakeOptions[i])[PROP_SOURCE]);
letOptionFakeSelected(selectBoxFakeOption);
Expand All @@ -502,6 +508,24 @@ function OP(source, state = {}) {
// No match!
}
valuePrev = value;
} else {
let marked = 0;
for (let i = 0, j = toCount(selectBoxFakeOptions), v; i < j; ++i) {
selectBoxFakeOption = selectBoxFakeOptions[i];
v = getHTML(selectBoxFakeOption);
if (hasValue('</mark>', v)) {
++marked;
}
}
// Reset all filter(s) if there is only one or none option marked
if (marked <= 1) {
for (let i = 0, j = toCount(selectBoxFakeOptions), v; i < j; ++i) {
selectBoxFakeOption = selectBoxFakeOptions[i];
v = getText(selectBoxFakeOption);
setHTML(selectBoxFakeOption, v);
selectBoxFakeOption.hidden = false;
}
}
}
}
if (KEY_ENTER !== key && KEY_ESCAPE !== key && KEY_TAB !== key) {
Expand Down

0 comments on commit 6f4688f

Please sign in to comment.