Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 #27930
What is the current behavior?
Currently, passing a falsy boolean prop like
disabled={false}in @ionic/react renders the host as<ion-button disabled="false">.disabledis an HTML boolean attribute, so its mere presence means "true" to assistive tech regardless of the value, and VoiceOver treats the button as disabled even though Ionic renders and behaves as enabled.On v9 the new @lit/react runtime fixes this for the generated components, but the hand-rolled wrappers (
createReactComponent,createRoutingComponent) still serialize booleans to attributes and sync props throughattachProps. So ion-button, ion-card, ion-fab-button, ion-item-option, ion-breadcrumb, ion-router-link, ion-back-button, and ion-tab-button keep the stray attribute.What is the new behavior?
attachPropsnow removes a stray="false"attribute after assigning the property, for any boolean prop that resolves tofalse.aria-*anddata-*attributes and the enumerated attributes (draggable,translate,spell-check,content-editable) are excluded, since"false"is meaningful there and differs from the attribute being absent.disabled={true}still renders the attribute and disables the control. Because the property is already the source of truth and React doesn't re-add an unchanged attribute, this holds across re-renders.Does this introduce a breaking change?
Other information
Tested at three levels:
attachPropsunit tests (utils.spec.ts), integration tests through the realcreateReactComponentandcreateRoutingComponentwrappers, and a real-browser Playwright e2e in the react-router test app (new/disabled-buttonroute) that asserts a realIonButtonwithdisabled={false}carries nodisabledattribute and its inner native button stays interactive, whiledisabled={true}disables it.Manual test page (after the branch deploys):