I am creating a typing application where user can press and hold Alt key and type any number for ex. 033 then this will search this number in mapping and will return the value from the map. It is working fine in windows. but when I am connecting physical keyboard with OTG cable in mobile (android) it is giving Unidentified. For example - I press and hold Alt key and type 0 then it is immidietely giving Undefined. I tried to console log event.key but that is also changing to Unidentified.
const [altCode, setAltCode] = useState("");
const handleKeyDown = (e) => {
let altDupCode = altCode === undefined ? "": altCode ;
if (e.altKey && e.key !== "Alt") {
altDupCode = altDupCode + e.key+"";
setAltCode(altDupCode);
} else {
altDupCode = "";
setAltCode("");
}
e.altKey &&
changeKrutidev055Shortcut(
altDupCode,
e,
setAltCode,
setActualInputValue,
setTotalKeystroke
);
}
};
This code is working fine in Windows. Only issue with Mobile.