I’m trying to capture the key pressed in a sp-textfield
using the wrapper component with onKeyDown
. The event only fires when non letter characters are pressed like the space bar and arrows. I see that onKeyPress
is not supported in UXP, but there’s no mention of onKeyDown
. onKeyUp
is not firing an event at all. Here’s what I’m trying:
(This only logs non letter characters)
const onKeyDownTest = (e) => {
console.log('e ', e);
};
<WC onKeyDown={onKeyDownTest}>
<sp-textfield
id="name-0"
placeholder="Type your comment here"
></sp-textfield>
</WC>
I’ve also tried variations and they are all working the same way I mentioned above.
<WC onKeyDown={onKeyDownTest}>
<input />
</WC>
<input onKeyDown={onKeyDownTest} />
I’m using React and hooks and wondering if that has to do with it?