Skip to content

Commit

Permalink
Add dispatch event to backspace handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Hekku2 committed Aug 9, 2021
1 parent 0cfc694 commit 5b06ab6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.1]

### Fixed

- Fix bug with backspace not updating model

## [0.9.0]

### Changed
Expand Down
5 changes: 3 additions & 2 deletions src/virtual-keyboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class VirtualKeyboardComponent implements OnInit, OnDestroy {
public placeholder: string;
public type: string;
public disabled: boolean;
public maxLength: number|string;
public maxLength: number | string;

private caretPosition: number;
private shift = false;
Expand Down Expand Up @@ -277,6 +277,7 @@ export class VirtualKeyboardComponent implements OnInit, OnDestroy {
this.inputElement.nativeElement.value = currentValue.substring(0, currentValue.length - 1);
}

this.dispatchEvents(event);
// Set focus to keyboard input
this.keyboardInput.nativeElement.focus();
break;
Expand Down Expand Up @@ -312,7 +313,7 @@ export class VirtualKeyboardComponent implements OnInit, OnDestroy {
// Simulate all needed events on base element
this.inputElement.nativeElement.dispatchEvent(new KeyboardEvent('keydown', eventInit));
this.inputElement.nativeElement.dispatchEvent(new KeyboardEvent('keypress', eventInit));
this.inputElement.nativeElement.dispatchEvent(new Event('input', {bubbles : true}));
this.inputElement.nativeElement.dispatchEvent(new Event('input', { bubbles: true }));
this.inputElement.nativeElement.dispatchEvent(new KeyboardEvent('keyup', eventInit));

// And set focus to input
Expand Down

0 comments on commit 5b06ab6

Please sign in to comment.