mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
fix(all): avoid using focus() since it conflicts with HTMLElement
fixes #15810
This commit is contained in:
@ -245,7 +245,7 @@ export class Input implements ComponentInterface {
|
||||
}
|
||||
|
||||
@Method()
|
||||
focus() {
|
||||
setFocus() {
|
||||
if (this.nativeInput) {
|
||||
this.nativeInput.focus();
|
||||
}
|
||||
|
||||
@ -57,9 +57,9 @@ It is meant for text `type` inputs only, such as `"text"`, `"password"`, `"email
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| ------- | ----------- |
|
||||
| `focus` | |
|
||||
| Method | Description |
|
||||
| ---------- | ----------- |
|
||||
| `setFocus` | |
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
@ -44,9 +44,9 @@ A Searchbar should be used instead of an input to search lists. A clear button i
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| ------- | ----------- |
|
||||
| `focus` | |
|
||||
| Method | Description |
|
||||
| ---------- | ----------- |
|
||||
| `setFocus` | |
|
||||
|
||||
|
||||
## CSS Custom Properties
|
||||
|
||||
@ -141,7 +141,7 @@ export class Searchbar implements ComponentInterface {
|
||||
protected valueChanged() {
|
||||
const inputEl = this.nativeInput;
|
||||
const value = this.value;
|
||||
if (inputEl.value !== value) {
|
||||
if (inputEl && inputEl.value !== value) {
|
||||
inputEl.value = value;
|
||||
}
|
||||
this.ionChange.emit({ value });
|
||||
@ -153,8 +153,10 @@ export class Searchbar implements ComponentInterface {
|
||||
}
|
||||
|
||||
@Method()
|
||||
focus() {
|
||||
this.nativeInput.focus();
|
||||
setFocus() {
|
||||
if (this.nativeInput) {
|
||||
this.nativeInput.focus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -48,9 +48,9 @@ The textarea component accepts the [native textarea attributes](https://develope
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| ------- | ----------- |
|
||||
| `focus` | |
|
||||
| Method | Description |
|
||||
| ---------- | ----------- |
|
||||
| `setFocus` | |
|
||||
|
||||
|
||||
## CSS Custom Properties
|
||||
|
||||
@ -169,7 +169,7 @@ export class Textarea implements ComponentInterface {
|
||||
}
|
||||
|
||||
@Method()
|
||||
focus() {
|
||||
setFocus() {
|
||||
if (this.nativeInput) {
|
||||
this.nativeInput.focus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user