mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
fix(input): don't allow focus when disabled is set (#10214)
Adds the disabled attribute to the parent input/textarea, also fixes where disabled textareas were focusable regardless of where disabled was set fixes #10155
This commit is contained in:

committed by
Justin Willis

parent
d3f4bc0616
commit
eba0866a34
@ -94,7 +94,7 @@ input.text-input:-webkit-autofill {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
ion-input[disabled] .input-cover {
|
||||
.input[disabled] .input-cover {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ export class TextInput extends Ion implements IonicFormInput {
|
||||
*/
|
||||
@Input()
|
||||
get disabled() {
|
||||
return this.ngControl ? this.ngControl.disabled : this._disabled;
|
||||
return this._disabled;
|
||||
}
|
||||
set disabled(val: boolean) {
|
||||
this.setDisabled(this._disabled = isTrueProperty(val));
|
||||
@ -226,10 +226,18 @@ export class TextInput extends Ion implements IonicFormInput {
|
||||
* @private
|
||||
*/
|
||||
setDisabled(val: boolean) {
|
||||
this._renderer.setElementAttribute(this._elementRef.nativeElement, 'disabled', val ? '' : null);
|
||||
this._item && this._item.setElementClass('item-input-disabled', val);
|
||||
this._native && this._native.isDisabled(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
setDisabledState(isDisabled: boolean) {
|
||||
this.disabled = isDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @input {boolean} If the input should be readonly or not
|
||||
*/
|
||||
|
Reference in New Issue
Block a user