Skip to content
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

Button | Twig | Add missing 'target' attribute #1266

Merged
merged 2 commits into from Jul 12, 2019

Conversation

danielamorse
Copy link
Collaborator

@danielamorse danielamorse commented Jul 12, 2019

Jira

http://vjira2:8080/browse/BDS-1415

Summary

Added target to Twig-rendered button-style link if passed in via attributes.

Details

Currently the way to add a target to a button is to pass it in via Twig attributes. This adds the prop to the custom element but not the inner semantic <a>, so you have to wait until the JS kicks in for it to be added. This PR adds it to the Twig-rendered markup so that it works with and without JS.

Note: the button schema needs to be updated to include url and target. This will be handled in a separate ticket.

How to test

  • Run the fix/button-missing-target branch locally.
  • Add this code to any button demo page:
{% include "@bolt-components-button/button.twig" with {
  text: "This is a button",
  url: "http://pega.com",
  attributes: {
    target: "_blank"
  }
} only %}
  • View the page with JS off and verify the link opens in a new window.

Copy link
Contributor

@sghoweri sghoweri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipit!

@sghoweri sghoweri merged commit 1cc01b8 into master Jul 12, 2019
@sghoweri sghoweri deleted the fix/button-missing-target branch July 12, 2019 19:13
@sghoweri sghoweri mentioned this pull request Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants