Skip to content

Debug mode rendered unusable if layout's yield is directly inside a Ruby construct #35

@asilano

Description

@asilano

It appears that, normally, the layout's <%= yield %> statement does not produce an target for the ERB debug mode tooltips. However, if the <%= yield %> is contained within a Ruby construct, then it does get involved in the ERB debug. What's more, it effectively takes precedence over all the other tags inside it - it's hard or impossible to hover elements that aren't right on the boundary of the yielded section, and if you do manage then the yield's tooltip appears above the tooltip you're interested in.

Steps to reproduce

With intercept_erb and debug_mode configured on, visit /examples/yield_blocking_debug. Enable "Show ERB Output Outlines" and "Show Tooltips". Attempt to hover the "Examples controller" output box.

Image

The layout file contains

  <body>
    <%= content_tag(:main) do %>
      <%= yield %>
    <% end %>
  </body>

Note: the <%= content_tag(:main) do %> block seems relevant to this issue.

The template file is:

<div style="width: 200px; height: 100px; margin: 10px; background-color: #aaaaff;">
  <p><%= controller.class.to_s.underscore.humanize %> provides a nice, long erb tag</p>
</div>

Expected

Should be able to hover over the tag and get its source code; and click to visit its code

Actual

The hover target for yield is triggered instead. If you're very careful, there's about 1 pixel where you can just get both to activate; in that case, the yield tooltip appears above the interesting one.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions