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

Setting "Default New Window" prevents target from working as expected #146

Open
johnfmorton opened this issue May 2, 2024 · 1 comment

Comments

@johnfmorton
Copy link

Describe the bug

When creating a new Hyper field, if I select "Default New Window" as true, the UX shows the New Window toggle as green. However, the Twig will not render "_blank" as expected.

Another issue I see may be related. In the field that has it's "Default New Window" as true, in the UX of the entry, you can toggle the value off, but it will always show "green" (true) when returning to the entry edit screen in the Craft control panel.its

Steps to reproduce

  1. Create a new Hyper field
  2. Default Link Type = "URL"
  3. Enable New Window = true
  4. Default New Window = true
  5. Add field to an entry type
  6. Create an entry and then view it on the front end, looking for the value of "target" on the Hyper field. It should be blank, even though New Window is true during the entry creation process.
  7. Go back to the entry edit page and attempt to turn off the New Window value.
  8. Save the entry
  9. Open the edit page again to find New Window set to true

Craft CMS version

4.9.0

Plugin version

1.1.28

Multi-site?

No

Additional context

No response

@engram-design
Copy link
Member

So this is more of a UI issue than anything I believe. Thanks to the video you sent through privately, I can see the issue is that you're toggling the New Window setting, but leaving the link blank. This means that the value for the field is technically empty, so it's switching back to the defaults. This is the same reason why Twig will not render "_blank" as expected.

If you did the same thing with a value in the link field, I'm seeing it save correctly.

At your Step 6 when you view an entry, that link field has no value at that point, so it's not going to show a value for the link, or for the other settings.

This is very much related to #8 where we need to provide a better UI for the empty state to prevent this sort of behaviour. That's probably going to be slated for Hyper 2 for Craft 5, as it's now a breaking change.

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

No branches or pull requests

2 participants