feat(pds-dropdown-menu-item): add http-method and data attribute support#660
Closed
pixelflips wants to merge 3 commits intomainfrom
Closed
feat(pds-dropdown-menu-item): add http-method and data attribute support#660pixelflips wants to merge 3 commits intomainfrom
pixelflips wants to merge 3 commits intomainfrom
Conversation
…ps and pdsBeforeSubmit event
…BeforeSubmit event
…ata attribute support
✅ Deploy Preview for pine-design-system ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Member
Author
|
This is too heavy handed for now. Will close in favor or a different approach. |
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.
Problem
When using
pds-dropdownfor action columns in consuming applications (e.g., Rails DataTableComponent), developers need to support features likemethod: :delete,remote: true, and custom data attributes for confirmations and modals. Currently, this requires using rawlink_tohelpers which generate<a>tags directly in the dropdown menu.This triggers console errors because
pds-dropdown-menustrictly validates its children and only acceptspds-dropdown-menu-itemandpds-dropdown-menu-separatorelements:Additionally, due to Shadow DOM encapsulation, external JavaScript frameworks cannot intercept click events on elements inside the shadow root, making it impossible for framework-specific handlers to process non-GET requests.
Solution
Enhance
pds-dropdown-menu-itemto natively support HTTP methods and framework data attributes, allowing consuming applications to use the proper component instead of raw<a>tags.New Props:
http-method: Specifies HTTP method (get, post, put, patch, delete) - handles form submission internally with CSRF tokenturbo-frame: Sets target frame for SPA navigationturbo: Controls SPA-style navigation behavior (boolean)New Event:
pdsBeforeSubmit: Cancellable event emitted before form submission for non-GET methods, allowing custom handling (e.g., confirmation dialogs)This is fully backward compatible - existing implementations are unaffected.
Fixes DSS-131
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: