3

I have a simple visualforce page running in Lightning Experience. As expected Salesforce wraps that in an iframe. But for some reason, the title attribute of the iframe is set to "accessibility title" even though the <apex:page> component has title attribute set. However, the title attribute value is appended to parent document's title, for example: "List View | Salesforce".

This affects screen readers readability. Because the iframe title is set like that, when a user is using a screen reader, in "accessibility mode", the title is read wrong.

<apex:page docType="html-5.0" 
  standardStylesheets="true" lightningStylesheets="true" sidebar="true"
  showHeader="true" controller="ListViewController" cache="false"
  action="{! redirect}" title="List View" applyBodyTag="false" applyHtmlTag="false">

  <html>
    <head>
      <title>My awesome title</title>
    </head>
    <body>
      <div>
         Some content
      </div>
    </body>
  </html>
</apex:page>

Here is the iframe generated.

<iframe force-alohapage_alohapage="" height="100%" width="100%" scrolling="yes" allowtransparency="true" name="vfFrameId_1588178295269" title="accessibility title" allowfullscreen="true" lang="en-US" allow="geolocation *; microphone *; camera *">
  #document
  <!doctype html>
    <html>
      <head>
       ...
</iframe>

The title tag is stripped away no matter what. Only the title attribute is considered for appending. Why is Salesforce rendering engine setting the iframe title to accessibility title? Is there an attribute I am missing? Or is there a setup parameter I need to override.

Any ideas would be helpful.

2

If either applyHtmlTag or applyBodyTag is false, the value of the title attribute is ignored. Change both of these tags to True and you will see that the iFrame title will change.

This information was found in the Visualforce Developers Guide in the apex:page Standard Component Reference section under the title Attribute description.

Visualforce generates an HTML head element unless other attributes of apex:page are set in such a way that one won't be generated. For example, if either applyHtmlTag or applyBodyTag is false, the value of the title attribute is ignored. These tags are used to take full control of the HTML generated by the page, and it's assumed that your page contains full and complete HTML markup, including your desired title element.

| improve this answer | |
  • I was playing around with those tags. Although from the documentation I see this If not specified, this value defaults to the value of the applyHtmlTag attribute if it's set, or true, if applyHtmlTag isn't set. So, I assumed this will be set to true. Conversely, when the both the tags are set to false, I expected the <title> tag text node will be used to set the iframe title. It does not. SF only uses value from the attribute depending on the condition above. – Amudh Apr 29 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.