Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class MatKeyboardKeyComponent implements OnInit {
// Manipulate the focused input / textarea value
const value = this.inputValue;
const caret = this.input ? this._getCursorPosition() : 0;

let char: string;
switch (this.key) {
// this keys have no actions yet
Expand Down Expand Up @@ -218,7 +218,7 @@ export class MatKeyboardKeyComponent implements OnInit {
}

if (char && this.input) {
this.inputValue = [value.slice(0, caret), char, value.slice(caret)].join('');
this.inputValue = caret ? [value.slice(0, caret), char, value.slice(caret)].join('') : value + char;
this._setCursorPosition(caret + 1);
}
}
Expand Down Expand Up @@ -272,7 +272,7 @@ export class MatKeyboardKeyComponent implements OnInit {
return;
}

this.inputValue = this.control.value;
this.inputValue = this.control ? this.control.value : this.inputValue;
// ^ this is used to not only get "focus", but
// to make sure we don't have it everything -selected-
// (it causes an issue in chrome, and having it doesn't hurt any other browser)
Expand Down