object elements with no alternative content
An embedded object with no fallback is announced as nothing at all. squirrel checks every object element on the page.
What alternative content is
<object> embeds an external resource: a PDF, an SVG, a legacy plugin document. When the resource cannot be displayed, the browser falls back to whatever sits between the opening and closing tags, and that fallback is what a reader gets instead.
With nothing between the tags and no label, a screen reader has an element it can find and nothing to say about it. Where the embedded resource does render, the fallback is not shown, so the resource has to carry its own accessibility as well.
What squirrel checks
One check, object-alt, at severity warning and weight 6. It covers every <object>, skipping any with role="presentation" or role="none" and any hidden from the accessibility tree (see below).
- Warn when the element has no non-empty
aria-label, noaria-labelledbyand no text content between its tags. Report message:N object element(s) without alternative content. Every offender is listed, identified byname, then by the subtype of itstypeasobject[type="pdf"], then by the filename from itsdataattribute asobject (report.pdf), then as a bareobject. - Pass with
N object element(s) have alternative content. - Info with
No object elements found.
Hidden object elements
An object element out of the accessibility tree has nothing to announce, so it is not reported: one with the hidden attribute (except hidden="until-found"), aria-hidden="true" on itself or an ancestor, display: none on itself or an ancestor (set inline or by a <style> rule squirrel can decide), or inside a closed <dialog> or an unopened popover. The pass message then reads “in the accessibility tree” and the count of skipped elements is kept in hiddenWithoutName. It still needs a name before it is shown.
squirrel reads the markup, inline styles and the page’s <style> blocks, the same way as form-labels; see form-labels for what it can and cannot decide. External stylesheets are not read. An unnamed object element that carries a no-js class, itself or on an ancestor other than <html>, is reported as unconfirmed on a page with an external stylesheet or an @import, because a theme usually hides that fallback once JavaScript runs. One a style may hide but squirrel cannot settle (a pseudo-class, a media query, a page that also loads an external stylesheet) is unconfirmed too. Report message: N object element(s) without alternative content may be hidden by a style (unconfirmed), under the check name object-alt-unconfirmed.
How to fix it
<object data="/reports/q3.pdf" type="application/pdf" aria-label="Q3 report">
<a href="/reports/q3.pdf">Download the Q3 report (PDF, 1.2 MB)</a>
</object>Put a real fallback between the tags. A link to the resource is the most useful one, because it is what a browser shows when it cannot render the embed. It is not a substitute for making the embedded document accessible when the embed does render.
For an inline SVG or an image, <img> is usually the better element. It has an alt attribute, it is easier to make responsive, and it avoids this rule entirely.
| Rule ID | a11y/object-alt |
| Category | Accessibility |
| Scope | Per-page |
| Severity | warning |
| Weight | 6/10 |
Enable / disable
Disable this rule
[rules]
disable = ["a11y/object-alt"]Disable all Accessibility rules
[rules]
disable = ["a11y/*"]Enable only this rule
[rules]
enable = ["a11y/object-alt"]enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.
Related rules
- a11y/frame-title: the same naming requirement for
<iframe>. - images/alt-text:
alton images, the more common form of the same idea. - a11y/video-captions: the alternative content video needs.
- a11y/input-image-alt: image inputs, which need
altas a button name.
Accessibility findings ship in every audit next to the SEO, performance and agent experience rules. See Website security scan with AI for how an agent works through a report.
References
- The object element, MDN
- Understanding SC 1.1.1 Non-text Content, W3C
- H53: Using the body of the object element, W3C
Check your site
Run squirrel audit https://example.com and open the Accessibility section of the report. Every unlabeled object is listed, with no cap on the count. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.