-
Notifications
You must be signed in to change notification settings - Fork 72
[LG-5794] chore: Added id prop support for ConfirmationModel buttons #3362
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
🦋 Changeset detectedLatest commit: 3c8d334 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Size Change: 0 B Total Size: 1.81 MB ℹ️ View Unchanged
|
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.
Pull request overview
This PR adds support for the id prop on ConfirmationModal buttons by switching from BaseButtonProps to ButtonProps. The change enables consumers to pass standard HTML button attributes like id through confirmButtonProps and cancelButtonProps.
Key changes:
- Updated button prop types from
BaseButtonPropstoButtonProps<'button'>to include standard HTML button attributes - Enhanced the
onClicksignature to accept optionalMouseEvent | KeyboardEventparameters - Added comprehensive test coverage for the new
idprop functionality
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts | Updated button prop types from BaseButtonProps to ButtonProps, added ButtonOnlyProps type to filter anchor-specific props, and updated onClick signature |
| packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.spec.tsx | Added tests for id prop propagation and custom onClick handlers with event parameters |
| .changeset/itchy-experts-relax.md | Documented the breaking change for the minor version bump |
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts
Outdated
Show resolved
Hide resolved
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.spec.tsx
Outdated
Show resolved
Hide resolved
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.spec.tsx
Show resolved
Hide resolved
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.spec.tsx
Outdated
Show resolved
Hide resolved
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.spec.tsx
Outdated
Show resolved
Hide resolved
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.spec.tsx
Outdated
Show resolved
Hide resolved
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts
Outdated
Show resolved
Hide resolved
packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts
Outdated
Show resolved
Hide resolved
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.
Sorry, one more thing. I think we should also add some tests in the types behave as expected block that verifies you can pass an ID and that the href is not accepted.
shaneeza
left a comment
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.
🎉
|
Coverage after merging ar/LG-5794-button into main will be
Coverage Report for Changed Files
|
✍️ Proposed changes
Adds support for the
idprop on ConfirmationModal buttons viaconfirmButtonPropsandcancelButtonProps. Updates button types to useButtonPropsand excludes anchor types to ensure buttons render as buttons.🎟️ Jira ticket: LG-5794
✅ Checklist
pnpm changesetand documented my changes🧪 How to test changes
ConfirmationModalwithconfirmButtonProps={{ id: 'my-confirm-btn' }}andcancelButtonProps={{ id: 'my-cancel-btn' }}.idattributes in the DOM.PR Title:
[LG-5794] chore(confirmation-modal): add id prop support for buttons