Simplified markup for input, textarea, and select #25661
Replies: 4 comments 9 replies
-
This is an interesting discussion.
I think you need to consider slots instead of attributes for this kind of extensibility. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I think this sounds great, usage looks a lot nicer. I'm super excited for Ionic 7 now! |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, Thank you for your feedback on this RFC! We will be moving forward with this proposed change in an upcoming release of Ionic Framework. |
Beta Was this translation helpful? Give feedback.
-
Definitions
Impacted Components:
ion-input
,ion-textarea
, andion-select
.Form Control/Form Component: A single impacted component such as
ion-input
.Summary
We would like to make the following changes to the impacted components:
Motivation
Form components in Ionic are impacted by multiple issues:
Screen readers announce form controls twice. Axe also warns of "nested form interactive" errors:
bug: axe DevTools reports several items as "not announced by screen reader" #23511
bug: Checkbox touch target issue when there is a link in the text - A11y issue #23289
bug: adding aria labels to host and input element inside shadow root causes issues with nvda #23213
bug: AXE: Elements must use only allowed ARIA attributes for ion-select #22715
Form components are tightly coupled with
ion-item
leading to unexpected behaviors:bug: Angular ion-item combined with stacked ion-label loses item-label-stacked class once ion-chip is added #24312
bug: ion-chip is disabled when ion-input is disabled when both are in same ion-item #23331
bug: Ion-input is broken with 4.7.x #19084
bug: ion-label inside ion-item aligns wrongly or disappers if custom Angular component is used in this ion-item when stacked or floating position is set #22736
bug: ion-button inside of an ion-label not clickable in v6 #24215
bug: delegatesFocus patch for ios causes rendering issues with item sliding in chrome #25273
Form component usage is verbose and requires both
ion-item
andion-label
in order to behavior correctly.It is unclear which features on
ion-item
apply to which form components.Features such as the
fill
andshape
properties only apply toion-input
,ion-textarea
, andion-select
. However, these properties are set onion-item
implying that they are available on all form components.Proposed Design
We would like to move all form component APIs from
ion-item
onto the form components themselves.Old Usage:
New Usage:
Notable Changes:
ion-item
andion-label
are no longer used.ion-item
such asfill
orcounter
have been moved to the form component.Benefits
ion-item
, allowing the Ionic team to provide for a more predictable user experience.Drawbacks
Why is this RFC separate from the other form control RFCs?
ion-input
andion-textarea
do not use the Shadow DOM and we do not have plans to change that. This means that certain features such as Shadow Parts and Slots are not available. As a result, the proposed API deviates slightly from other RFCs such as #25660.For example, developers provide a label on
ion-input
using a property instead of using a slot like they would do forion-radio
.Migration Path and Breaking Changes
This change would ship in Ionic 7.0 at the earliest. We would like to support both the old usage and the new usage for the entire Ionic 7 lifecycle. This will allow developers to migrate their form components at their own pace. It will also reduce the barrier to upgrading to Ionic 7.0.
The following features will be deprecated in Ionic 7.0:
helper
anderror
slots onion-item
.shape
,fill
,counter
, andcounterFormatter
properties.--highlight-color-focused,
--highlight-color-invalid
,--highlight-color-valid
,--highlight-height
CSS variables onion-item
.ion-item
.Note: We do not plan to make any breaking changes in Ionic 7.0 as a result of this proposal.
The following features will be removed in Ionic 8.0 at the earliest:
helper
anderror
slots onion-item
.shape
,fill
,counter
, andcounterFormatter
properties.--highlight-color-focused,
--highlight-color-invalid
,--highlight-color-valid
,--highlight-height
CSS variables onion-item
.ion-item
.Beta Was this translation helpful? Give feedback.
All reactions