Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
¿Cómo puedo bloquear el evento de doble espacio en macOs?

Me gustaría bloquear el evento que ocurre cuando se presiona la barra espaciadora. El punto es que el usuario no debería poder ingresar un espacio vacío en la entrada. El problema ocurre en el sistema macOs donde el doble espacio se convierte en un punto. Luego, a pesar de que la entrada en la plantilla tiene (keydown.space)="$event.preventDefault()" , se agrega un punto al texto de entrada con un espacio al final. ¿Hay alguna opción para bloquear este comportamiento? También traté de editar texto con setValue en valueChanges , pero luego el cursor cambia de posición y no se ve bien. Estaré muy agradecido por cualquier sugerencia.

 // profile.component.ts @Component({ selector: 'app-profile', templateUrl: './profile.component.html', styleUrls: ['./profile.component.scss'], }) export class ProfileComponent implements OnInit, OnDestroy { userEmail = new FormControl(''); destroy$ = new Subject<void>(); ngOnInit() { this.observeUserEmailValue(); } ngOnDestroy(): void { this.destroy$.next(); this.destroy$.unsubscribe(); } observeUserEmailValue(): void { this.userEmail.valueChanges .pipe(takeUntil(this.destroy$)) .subscribe((userEmailValue: string) => { this.userEmail.setValue(userEmailValue.trim(), { emitEvent: false, }); }); } } // profile.component.html <input type="email" [formControl]="userEmail" (keydown.space)="$event.preventDefault()" >
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que el comportamiento que desea evitar podría estar en keyup , no keydown .

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!