79365220

Date: 2025-01-17 15:21:02
Score: 0.5
Natty:
Report link

To @Michael Liu,

In my trial, I found that

  1. shift key is NOT detected when I pressed shift key with following code.
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <input type="text" (keyup)="updateField($event)" />
  `,
})
export class AppComponent {
  title = 'app-project';
  updateField(event: KeyboardEvent): void {
    
    // if (event.altKey && event.key === 'ShiftLeft') {
    if (event.shiftKey) {
      console.group('updateField in AppComponent class when the user pressed alt and left shift key at same time in the text field.');
      console.log('The user pressed alt and left shift key at same time in the text field.');
      console.groupEnd();
    } 
  }
}

1th update

continue previous answer.

In my trial, I found that

  1. shift key is NOT detected when I pressed shift key with following code.
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <input type="text" (keyup.shift)="updateField($event)" />
  `,
})
export class AppComponent {
  title = 'app-project';
  updateField(event: Event): void {
      console.group('updateField in AppComponent class when the user pressed alt and left shift key at same time in the text field.');
      console.log('The user pressed alt and left shift key at same time in the text field.');
      console.groupEnd();
  }
}
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Michael
  • Low reputation (1):
Posted by: GeeksMathGeeks