1

I want to use read aloud extension in my angular app. if we select some text and press alt+P, we can hear that text. Now I want to use a button to dispatch a key board event of alt+P. But it is not working. Please guide me if someone has answer.

I think that in my keyboard event isTrusted is false because I'm dispatching an event.

Thats what I'm doing.

dispatchEvent1(elRef) {
        let keyPress = new KeyboardEvent('keypress', { key: 'P', altKey: true });
        
        console.log('key keyPress', keyPress, elRef, elRef.dispatchEvent(keyPress));
    }

Ali Jawad
  • 11
  • 1

0 Answers0