Skip to content

Commit 6e477b7

Browse files
authored
refactor(searchbar): autocapitalize defaults to off (#29107)
BREAKING CHANGE: The `autocapitalize` property on Searchbar now defaults to `'off'`.
1 parent 44529f0 commit 6e477b7

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

BREAKING.md

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
3030
- [Progress bar](#version-8x-progress-bar)
3131
- [Radio](#version-8x-radio)
3232
- [Range](#version-8x-range)
33+
- [Searchbar](#version-8x-searchbar)
3334
- [Select](#version-8x-select)
3435
- [Textarea](#version-8x-textarea)
3536
- [Toggle](#version-8x-toggle)
@@ -264,6 +265,10 @@ For more information on styling toast buttons, refer to the [Toast Theming docum
264265

265266
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-range` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy range syntax, refer to the [Range documentation](https://ionicframework.com/docs/api/range#migrating-from-legacy-range-syntax).
266267

268+
<h4 id="version-8x-searchbar">Searchbar</h4>
269+
270+
- The `autocapitalize` property now defaults to `'off'`.
271+
267272
<h4 id="version-8x-select">Select</h4>
268273

269274
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-select` inside of an `ion-item` with an `ion-label`, have been removed. Ionic will also no longer attempt to automatically associate form controls with sibling `<label>` elements as these label elements are now used inside the form control. Developers should provide a label (either visible text or `aria-label`) directly to the form control. For more information on migrating from the legacy select syntax, refer to the [Select documentation](https://ionicframework.com/docs/api/select#migrating-from-legacy-select-syntax).

core/api.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ ion-row,shadow
11661166

11671167
ion-searchbar,scoped
11681168
ion-searchbar,prop,animated,boolean,false,false,false
1169-
ion-searchbar,prop,autocapitalize,string,undefined,true,false
1169+
ion-searchbar,prop,autocapitalize,string,'off',false,false
11701170
ion-searchbar,prop,autocomplete,"name" | "email" | "tel" | "url" | "on" | "off" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "photo",'off',false,false
11711171
ion-searchbar,prop,autocorrect,"off" | "on",'off',false,false
11721172
ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', arrowBackSharp) as string,false,false

core/src/components.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7213,7 +7213,7 @@ declare namespace LocalJSX {
72137213
/**
72147214
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user. Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
72157215
*/
7216-
"autocapitalize": string;
7216+
"autocapitalize"?: string;
72177217
/**
72187218
* Set the input's autocomplete property.
72197219
*/

core/src/components/searchbar/searchbar.tsx

+1-16
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,11 @@ export class Searchbar implements ComponentInterface {
7878
*/
7979
@Prop() animated = false;
8080

81-
/**
82-
* Prior to the addition of this property
83-
* autocapitalize was enabled by default on iOS
84-
* and disabled by default on Android
85-
* for Searchbar. The autocapitalize type on HTMLElement
86-
* requires that it be a string and never undefined.
87-
* However, setting it to a string value would be a breaking change
88-
* in behavior, so we use "!" to tell TypeScript that this property
89-
* is always defined so we can rely on the browser defaults. Browsers
90-
* will automatically set a default value if the developer does not set one.
91-
*
92-
* In the future, this property will default to "off" to align with
93-
* Input and Textarea, and the "!" will not be needed.
94-
*/
95-
9681
/**
9782
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
9883
* Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
9984
*/
100-
@Prop() autocapitalize!: string;
85+
@Prop() autocapitalize: string = 'off';
10186

10287
/**
10388
* Set the input's autocomplete property.

0 commit comments

Comments
 (0)