2

I'm trying to get the events generated by a button that I assume is specific to brazilian keyboard, the "Próximo" button (same as "Next"). Some devices I work with have this button, and I can't listen to the events generated by them, if they emit any events at all.

Keyboard example

The app I use is developed with Ionic and Angular. The purpose of listening to this button is as follows: I have an array of objects and a page that displays an object's data. The user can modify the object data through some inputs. The user can navigate between these inputs through the "Next" button. When the user is at the last input and presses the button, the next object is loaded.

This event and function already work with the "Enter", "Next" and "Go" button, that exist on some devices and as far as I've noticed are visual variations of the same button. The only problem I have is with this "Próximo" button that does not generate any event, therefore it does not activate the function. I've already tried to listen for the event of this button using different methods, which I will list below.

Note: test() is a function that only logs the key event

Keydown, keypress and keyup property in ion-input, also with variants as keyup.enter

<ion-input (keypress)="test($event)"></ion-input>

(ionInput) property on ion-input

<ion-input (ionInput)="test($event)"></ion-input>

Listener with pure JavaScript (tested with keydown, keypress and keyup and their variants)

ionViewDidLoad() {
    document.addEventListener('keydown', (key) => {this.test(key)} );
}

Angular's HostListener (tested with keydown, keypress and keyup and their variants)

// I also tried with `'window:keydown'`
@HostListener('keydown', ['$event']) test(event) {
    console.log(event);
}

References:

leonardofmed
  • 842
  • 3
  • 13
  • 47

0 Answers0