You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Feature Request
Hello,
Ionic 3 does not offer the possibility to disable an ion-searchbar, with ionic 4 it is still not possible.
But there was a technique to make it disabled in OnInit:
const ionSearchBarInputBox: any = this.searchBar.nativeElement.querySelector('input');
ionSearchBarInputBox.disabled = true;
Except with Ionic 4 this technique does not work anymore. The input element is not generated at the time of ngOnInit or ngAfterViewInit
You have to put these lines of code in a setTimeout of 500 for it to work. Which is not stable.
Describe Preferred Solution
The input should be disabled at the time of its generation
Describe Alternatives
It would be nice to have a disabled attribute as on other input to disable easily
This issue has been labeled as help wanted. This label is added to issues that we believe would be good for contributors.
If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.
For a guide on how to create a pull request and test this project locally to see your changes, see our contributing documentation.
I just tested by adding the attribute "showCancelButton" with a default value. The cancel button is not visible, which seems fine to me. If the field is disabled, we must not be able to change its content. Finally it's my point of view.
Oh forks... I accidentally deleted my previous comment trying to edit it and cannot get it back :(
Anyway, yes I was mostly referring to the fact that the searchbar input is more complicated than other inputs since it has more than one components (i.e. clear and cancel) You are correct that cancel and clear buttons are not visible when the focus is lost, which is what happens if the input is disabled anyway, so there should be no issue there.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
ionitron-bot commentedon Apr 2, 2019
This issue has been labeled as
help wanted. This label is added to issues that we believe would be good for contributors.If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.
For a guide on how to create a pull request and test this project locally to see your changes, see our contributing documentation.
Thank you!
KyDenZ commentedon Apr 10, 2019
@masimplo it's a good reflection
I just tested by adding the attribute "showCancelButton" with a default value. The cancel button is not visible, which seems fine to me. If the field is disabled, we must not be able to change its content. Finally it's my point of view.
masimplo commentedon Apr 10, 2019
Oh forks... I accidentally deleted my previous comment trying to edit it and cannot get it back :(
Anyway, yes I was mostly referring to the fact that the searchbar input is more complicated than other inputs since it has more than one components (i.e. clear and cancel) You are correct that cancel and clear buttons are not visible when the focus is lost, which is what happens if the input is disabled anyway, so there should be no issue there.
AlekNiebla commentedon Apr 20, 2019
Hey can I take a look at this issue?
KyDenZ commentedon Apr 21, 2019
The pull request has been sent
merge release-4.4.0
chore(): resolve merge conflicts from older hotfix
4.4.0
chore(): resolve conflicts from older hotifx
ionitron-bot commentedon May 22, 2019
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
merge release-4.4.1