fix(searchbar): autocapitalize is initialized correctly - #29197
Merged
Conversation
mapsandapps
approved these changes
Mar 21, 2024
mapsandapps
left a comment
Contributor
There was a problem hiding this comment.
Makes sense. I tested it & it works 👍🏻
sean-perkins
approved these changes
Mar 21, 2024
3 tasks
aeharding
added a commit
to aeharding/voyager
that referenced
this pull request
Mar 22, 2024
aeharding
added a commit
to aeharding/voyager
that referenced
this pull request
Mar 22, 2024
* Upgrade dependencies * ionic v8 upgrade * Remove old browser support (due to Ionic upgrade) incl. iOS 14 support * Temporary patch for Ionic issue ionic-team/ionic-framework#29197
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: resolves #29193
What is the current behavior?
In an attempt to preserve backwards compatibility when adding
autocapitalizeto Searchbar, we used!to indicate that the prop was never undefined. TheautocapitalizeonHTMLElementexpects this value to be a string and never undefined.For the purposes of the property on Searchbar, setting this prop to one of the accepted values would constitute a breaking change because it would override the default browser behavior (which we previously relied upon). As a result, we used
!to not set a default prop but inform TypeScript that this prop is always defined. This unintentionally made it so developers needed to define theautocapitalizeproperty every time which is not what we want.What is the new behavior?
autocapitalizenow defaults to the'default'keyword. This is an internal keyword that is used to tell Ionic to not set theautocapitalizeattribute on the innerinputelement and instead rely on the default browser behavior. This satisfies theHTMLElementrequirement thatautocapitalizeis never undefined. In Ionic 8 this'default'value will be replaced with'off'.Typescript currently sets the
HTMLElementautocapitalizetype tostringwhich is why we can add a'default'keyword here. There is some risk that if these type definitions change in the future that applications may encounter errors. However, changing this on the TypeScript side would itself be a breaking change. Additionally, we are moving away from'default'in Ionic 8, so I think this is an acceptable amount of risk.Does this introduce a breaking change?
Other information
Dev build:
7.8.2-dev.11711027016.13b2a920Tested in a React starter app with Searchbar, and I verified this fix works.