When previewing a page display, the title set for the view is printed without the h1 tag (not wrapped in any tag at all actually). This causes the preview to not match the theme of the site:

<div class="views-query-info">
  <table></table>
</div>
<div class="view view-test-view view-id-test_view view-display-id-page view-dom-id-d7ea2a86f98ef8918d1e712ee5b65963">
        Test View Title          <div class="view-header">
      <div id="node-8" class="node node-page clearfix" about="/page/test-view" typeof="foaf:Document">
...

In the above code the Test View Title text (which is actually the page display title) should be wrapped in an h1 tag like when printed in the actual page:

<div id="page-title">
  <h1>Test View Title</h1>
</div>

Comments

Status:Active» Closed (works as designed)

Unless something is changed, the title of the view is not normally printed at all during preview, because the title is handled separately. Ordinarily it will show up in the view information box (i.,e views-query-info), but not within the view itself. (note: Some things have changed lately; this could be a recent change that I haven't followed, but I hope not. Checking the code it doesn't look like it).

In any case, your assumption is incorrect. The H1 tag that would be provided by a page view is in your page.tpl.php and Views has no idea what that markup actually would be; as a result, Views cannot give you a reliable preview of it, even if it were printing the title.

My guess is that you have an alter or a views-view.tpl.php somewhere that is adding the title for some reason or other, and that is where that title is coming from. I'm fairly confident stock Views won't show it to you.

Status:Active» Closed (works as designed)

For starters, thanx for taking the time to reply. I honestly appreciate it. Now:

... I'm fairly confident stock Views won't show it to you.

Yes it does. Just give this a quick spin at simplytest.me (no need to create any content - just an empty view with only the defaults):

1. Go to Structure -> Views
2. Click "Add new view"
3. Fill in "test view" as the view name
4. Keep all settings as they are - Simply click "Continue & edit"
5. Check the preview area:

<div class="preview-section">
  test view
</div>

I'm merely suggesting that it should at the very least wrap the title text in an h1 tag (perhaps with the default id and class the all nodes get out of the box):

<div class="preview-section">
  <h1 id="page-title" class="title">test view</h1>
</div>

I believe that this would suffice in order to provide a preview that is close (if not identical) to the actual page when viewed

Status:Closed (works as designed)» Active

...sorry, just in case you're filtering closed issues out of your display.

Status:Closed (works as designed)» Active

...(perhaps with the default id and class the all nodes get out of the box):

<div class="preview-section">
  <h1 id="page-title" class="title">test view</h1>
</div>

...scratch that. I just checked with the Seven theme and it uses only a page-title class instead of an id and no additional classes:

<h1 class="page-title">Welcome to Drupal standard</h1>

So I guess its theme specific. Oh well, if there is no easy way to pull the ids and classes added to each theme's h1, then a simple h1 tag around it would do.

Well, it does look like it's in views-view.tpl.php

An H1 would still be wrong. Though frankly that title being there *at all* is wrong. I don't know why it even is there. The fact that it is being printed there is a bug.

Well, according to views_view_preprocess it is actually only appearing during the live preview, and it's to support the contextual links in the preview.

Let me elaborate, though: H1 isn't appropriate on blocks, for example, and many views are blocks. THey're not appropriate on panel panes. Nor are they appropriate on the views used by entity reference. Just as another example. Trying to put something appropriate there is kind of difficult without spending a lot of time learning what that appropriate thing actually is.

..ok I fully understand all that. Is there a way to selectively print markup (or even the whole title altogether) in the preview only in whichever display makes sense. For example, wrap the title in h1 tags for page displays but use h2 for block displays* etc.?

As for the part where displaying the title at all constitutes a bug, well I'm not quite sure about that. How about we respect the "Title" setting of each display? When it comes to blocks, we could (in addition to the "Title" setting of the block display) also check the respective "Block title" setting in the actual block (under /admin/structure/block/manage/views/<block_display_name>/configure) and hide the title if it is set to <none>.

* I checked Bartik, Garland, Seven and Stark - they all use h2 tags for their block titles.