-
Notifications
You must be signed in to change notification settings - Fork 13.5k
feat(alert, toast): pass arbitrary HTML attributes to host element #23891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For AlertInput
, we allows developers to pass in an attributes
object: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/alert/alert-interface.ts#L38
Should we do the same thing here to keep the API consistent?
Yeah, I think that might be better. I can do that for both alert and toast. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good. We need to add tests to verify this behavior. Might want to add a spec test since we are testing what attributes get rendered on the host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: resolves #23825
What is the new behavior?
ion-toast
andion-alert
now accept anhtmlAttributes
prop, which allows developers to pass arbitrary attributes to the host element. Potential use cases include overriding the default ARIA role or setting a customdata-testid
.Does this introduce a breaking change?
Other information