mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
refactor(many): clarify deprecation warning (#26834)
This commit is contained in:
@ -283,12 +283,10 @@ export class Checkbox implements ComponentInterface {
|
|||||||
private renderLegacyCheckbox() {
|
private renderLegacyCheckbox() {
|
||||||
if (!this.hasLoggedDeprecationWarning) {
|
if (!this.hasLoggedDeprecationWarning) {
|
||||||
printIonWarning(
|
printIonWarning(
|
||||||
`Using ion-checkbox with an ion-label has been deprecated. To migrate, remove the ion-label and pass your label directly into ion-checkbox instead.
|
`ion-checkbox now requires providing a label with either the default slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.
|
||||||
|
|
||||||
Example: <ion-checkbox>Label</ion-checkbox>
|
Example: <ion-checkbox>Label</ion-checkbox>
|
||||||
|
Example with aria-label: <ion-checkbox aria-label="Label"></ion-checkbox>
|
||||||
For checkboxes that do not have a visible label, developers should use "aria-label" so screen readers can announce the purpose of the checkbox.
|
|
||||||
|
|
||||||
For checkboxes that do not render the label immediately next to the checkbox, developers may continue to use "ion-label" but must manually associate the label with the checkbox by using "aria-labelledby".
|
|
||||||
|
|
||||||
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
||||||
this.el
|
this.el
|
||||||
|
@ -719,13 +719,14 @@ export class Input implements ComponentInterface {
|
|||||||
private renderLegacyInput() {
|
private renderLegacyInput() {
|
||||||
if (!this.hasLoggedDeprecationWarning) {
|
if (!this.hasLoggedDeprecationWarning) {
|
||||||
printIonWarning(
|
printIonWarning(
|
||||||
`Using ion-input with an ion-label has been deprecated. To migrate, remove the ion-label and use the "label" property on ion-input instead.
|
`ion-input now requires providing a label with either the "label" property or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the "label" property or the "aria-label" attribute.
|
||||||
|
|
||||||
Example: <ion-input label="Email"></ion-input>
|
Example: <ion-input label="Email"></ion-input>
|
||||||
|
Example with aria-label: <ion-input aria-label="Email"></ion-input>
|
||||||
|
|
||||||
For inputs that do not have a visible label, developers should use "aria-label" so screen readers can announce the purpose of the input.
|
For inputs that do not render the label immediately next to the input, developers may continue to use "ion-label" but must manually associate the label with the input by using "aria-labelledby".
|
||||||
|
|
||||||
For inputs that do not render the label immediately next to the input, developers may continue to use "ion-label" but must manually associate the label with the input by using "aria-labelledby".`,
|
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
||||||
this.el
|
this.el
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -263,12 +263,12 @@ export class Radio implements ComponentInterface {
|
|||||||
private renderLegacyRadio() {
|
private renderLegacyRadio() {
|
||||||
if (!this.hasLoggedDeprecationWarning) {
|
if (!this.hasLoggedDeprecationWarning) {
|
||||||
printIonWarning(
|
printIonWarning(
|
||||||
`Using ion-radio with an ion-label has been deprecated. To migrate, remove the ion-label and pass your label directly into ion-radio instead.
|
`ion-radio now requires providing a label with either the default slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.
|
||||||
Example: <ion-radio>Option Label:</ion-radio>
|
|
||||||
|
|
||||||
For radios that do not have a visible label, developers should use "aria-label" so screen readers can announce the purpose of the radio.
|
Example: <ion-radio>Option Label</ion-radio>
|
||||||
|
Example with aria-label: <ion-radio aria-label="Option Label"></ion-radio>
|
||||||
|
|
||||||
For radios that do not render the label immediately next to the radio, developers may continue to use "ion-label" but must manually associate the label with the radio by using "aria-labelledby".`,
|
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
||||||
this.el
|
this.el
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -553,13 +553,12 @@ export class Range implements ComponentInterface {
|
|||||||
private renderLegacyRange() {
|
private renderLegacyRange() {
|
||||||
if (!this.hasLoggedDeprecationWarning) {
|
if (!this.hasLoggedDeprecationWarning) {
|
||||||
printIonWarning(
|
printIonWarning(
|
||||||
`Using ion-range with an ion-label has been deprecated. To migrate, remove the ion-label and pass your label directly into ion-range instead.
|
`ion-range now requires providing a label with either the label slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.
|
||||||
|
|
||||||
Example: <ion-range><div slot="label">Volume:</div></ion-range>
|
Example: <ion-range><div slot="label">Volume</div></ion-range>
|
||||||
|
Example with aria-label: <ion-range aria-label="Volume"></ion-range>
|
||||||
|
|
||||||
For ranges that do not have a visible label, developers should use "aria-label" so screen readers can announce the purpose of the range.
|
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
||||||
|
|
||||||
For ranges that do not render the label immediately next to the range, developers may continue to use "ion-label" but must manually associate the label with the range by using "aria-labelledby".`,
|
|
||||||
this.el
|
this.el
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -779,13 +779,12 @@ export class Select implements ComponentInterface {
|
|||||||
private renderLegacySelect() {
|
private renderLegacySelect() {
|
||||||
if (!this.hasLoggedDeprecationWarning) {
|
if (!this.hasLoggedDeprecationWarning) {
|
||||||
printIonWarning(
|
printIonWarning(
|
||||||
`Using ion-select with an ion-label has been deprecated. To migrate, remove the ion-label and use the "label" property on ion-select instead.
|
`ion-select now requires providing a label with either the "label" property or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the "label" property or the "aria-label" attribute.
|
||||||
|
|
||||||
Example: <ion-select label="Favorite Color">...</ion-select>
|
Example: <ion-select label="Favorite Color">...</ion-select>
|
||||||
|
Example with aria-label: <ion-select aria-label="Favorite Color">...</ion-select>
|
||||||
|
|
||||||
For selects that do not have a visible label, developers should use "aria-label" so screen readers can announce the purpose of the select.
|
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
||||||
|
|
||||||
For selects that do not render the label immediately next to the select, developers may continue to use "ion-label" but must manually associate the label with the select by using "aria-labelledby".`,
|
|
||||||
this.el
|
this.el
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -465,8 +465,14 @@ export class Textarea implements ComponentInterface {
|
|||||||
private renderLegacyTextarea() {
|
private renderLegacyTextarea() {
|
||||||
if (!this.hasLoggedDeprecationWarning) {
|
if (!this.hasLoggedDeprecationWarning) {
|
||||||
printIonWarning(
|
printIonWarning(
|
||||||
`Using ion-textarea with an ion-label has been deprecated. To migrate, remove the ion-label and use the "label" property on ion-textarea instead.
|
`ion-textarea now requires providing a label with either the "label" property or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the "label" property or the "aria-label" attribute.
|
||||||
For textareas that do not have a visible label, developers should use "aria-label" so screen readers can announce the purpose of the textarea.`,
|
|
||||||
|
Example: <ion-textarea label="Comments"></ion-textarea>
|
||||||
|
Example with aria-label: <ion-textarea aria-label="Comments"></ion-textarea>
|
||||||
|
|
||||||
|
For textareas that do not render the label immediately next to the input, developers may continue to use "ion-label" but must manually associate the label with the textarea by using "aria-labelledby".
|
||||||
|
|
||||||
|
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
||||||
this.el
|
this.el
|
||||||
);
|
);
|
||||||
this.hasLoggedDeprecationWarning = true;
|
this.hasLoggedDeprecationWarning = true;
|
||||||
|
@ -350,13 +350,12 @@ export class Toggle implements ComponentInterface {
|
|||||||
private renderLegacyToggle() {
|
private renderLegacyToggle() {
|
||||||
if (!this.hasLoggedDeprecationWarning) {
|
if (!this.hasLoggedDeprecationWarning) {
|
||||||
printIonWarning(
|
printIonWarning(
|
||||||
`Using ion-toggle with an ion-label has been deprecated. To migrate, remove the ion-label and pass your label directly into ion-toggle instead.
|
`ion-toggle now requires providing a label with either the default slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.
|
||||||
|
|
||||||
Example: <ion-toggle>Email:</ion-toggle>
|
Example: <ion-toggle>Email</ion-toggle>
|
||||||
|
Example with aria-label: <ion-toggle aria-label="Email"></ion-toggle>
|
||||||
|
|
||||||
For toggles that do not have a visible label, developers should use "aria-label" so screen readers can announce the purpose of the toggle.
|
Developers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,
|
||||||
|
|
||||||
For toggles that do not render the label immediately next to the toggle, developers may continue to use "ion-label" but must manually associate the label with the toggle by using "aria-labelledby".`,
|
|
||||||
this.el
|
this.el
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user