Conversation
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.
Summary
This PR adds two reusable anonymous Twig components to BootstrapAdminUi:
sylius_bootstrap_admin_ui:copy_to_clipboard: a standalone copy button, leaving consumers free to render the value separately.sylius_bootstrap_admin_ui:copyable: displays a value or custom inline content next to the copy button.Both copy the explicit
valueprop, never the rendered text. This supports resource IDs, product codes, email addresses, badges, and truncated or formatted labels without coupling clipboard behavior to presentation.Implementation
Components and customization
copyabledisplays the escaped value by default and accepts custom markup through itscontentblock. The copy button remains separate from that content, including links.copyablecontainer;button:attributes customize the nested button.button_classcan replace the default button classes.hookableMetadatawithout printing it as an HTML attribute.null, and empty-string values disable copying; numeric and string zero remain copyable. An explicitdisabledprop is also supported.Clipboard behavior and accessibility
aria-busywithout disabling the button or removing keyboard focus.titleand accessiblearia-label, without requiring Bootstrap tooltip initialization for dynamically inserted content.Documentation and integration
Usage
Standalone button:
Default value display with a copy button:
Custom content, with the copied value independent of its presentation:
Direct Twig Hooks integration:
Testing
The controller tests do not replace browser-level validation of clipboard permissions, focus behavior, or assistive technologies; those have not been tested in a real browser here.