BUGFIX: template-require-iframe-title — flag title={{null|undefined|number}}#16
Closed
BUGFIX: template-require-iframe-title — flag title={{null|undefined|number}}#16
Conversation
Before: the rule only rejected title={{false}} among mustache literals.
title={{null}}, title={{undefined}}, and title={{42}} (any non-string
literal) were silently accepted even though none produces a useful
accessible name for an <iframe>.
Fix: extract isInvalidTitleLiteral(); treat boolean, null, undefined,
and numeric literals as invalid title values in both GlimmerMustacheStatement
and single-part GlimmerConcatStatement positions.
Six new invalid tests (3 literal types × 2 syntax forms).
Note: whitespace-only title values (e.g. title=" ") remain flagged —
the audit suggested upstream jsx-a11y accepts these, but an all-whitespace
title provides no accessible name, so our stricter behavior is kept.
🏎️ Benchmark Comparison
Full mitata output |
Translates 33 cases from peer-plugin rules:
- jsx-a11y iframe-has-title
- vuejs-accessibility iframe-has-title
- lit-a11y iframe-title
Fixture documents parity after this fix:
- title={{null|undefined|number}} and concat `title="{{null}}"`
/ `title="{{42}}"` are now flagged via dynamicFalseTitle.
Remaining divergences (title={{""}} still accepted, aria-hidden /
hidden exemption, whitespace-only title over-flagged, duplicate-title
detection inherited from ember-template-lint) are annotated inline.
Owner
Author
|
Moved upstream to ember-cli#2731. See that PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<iframe>needs a non-empty stringtitlefor assistive technology. Mustache literals like{{null}},{{undefined}}, or{{42}}produce no meaningful accessible name.title={{false}}.title={{null}},title={{undefined}}, andtitle={{42}}silently passed.Fix: extract
isInvalidTitleLiteral(); treatGlimmerBooleanLiteral,GlimmerNullLiteral,GlimmerUndefinedLiteral, andGlimmerNumberLiteralas invalid title values in bothGlimmerMustacheStatementand single-partGlimmerConcatStatementpositions.Six new invalid tests (3 literal types × 2 syntax forms:
title={{x}}vstitle="{{x}}").Whitespace-only title values (e.g.
title=" ") remain flagged. The audit noted jsx-a11y accepts those, but a whitespace-only title provides no accessible name — keeping our stricter behavior.Prior art
iframe-has-titlegetPropValue; non-string literals (null/undefined/number) all fail the truthy-string check.iframe-has-titleiframe-titleUpstream
[email protected]has the same under-flag.