Skip to content

fixed input number value #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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