Connect & Get help from fellow developers on our Discord community.
Ask the Community
Text Truncation
The text truncation rule checks whether visible text content remains fully readable when users increase the font size. Truncated text can hide critical information, especially for users with low vision or those who rely on larger text for comfortable reading. Visible and resizable text improves accessibility and provides a consistent experience for all users.
- Rule Category :
Readable Text and Layout
- WCAG 2.1 & 2.2 SC :
1.4.4 (AA)
- Rule Severity :
Critical
- Supported Platforms :
Android, iOS
Success criteria
The specific criteria for success are:
- Scalable fonts: Text must use relative units to allow dynamic resizing.
- Flexible layouts: Text containers must use dynamic sizing.
- No fixed sizes: Avoid fixed height or width values that prevent text containers from resizing to fit larger text.
-
Scrollable containers (if needed): If the layout cannot expand, use a scrollable container (
ScrollView
on Android,UIScrollView
on iOS) so users can access all text content.
How to fix
To prevent text truncation:
-
Use scalable text: Use
sp
for text so it scales when users increase font size (up to 200% as applicable in this rule). -
Use flexible layout: Ensure the text container (e.g., a
TextView
on Android) and its parent views do not have fixed sizes, such asdp
widths or heights. -
Use relative layout dimensions: Replace fixed sizes with
wrap_content
,match_parent
, or0dp
with weight. -
Allow vertical expansion: Set
layout_height
towrap_content
so the container size increases along with the text size. -
Provide scrolling if needed: If the text is expected to be long, place the
TextView
inside aScrollView
so all content remains accessible.
-
Use scalable text (Dynamic Type): Use system-scalable fonts (for example,
UIFont.preferredFont(forTextStyle:)
) and enable automatic adjustment so text responds to the user’s content size settings. - Use relative sizing with Auto Layout: Define label and container sizes with Auto Layout constraints instead of fixed frames or hardcoded point values. Avoid fixed width/height constants that prevent resizing.
-
Allow vertical expansion: Ensure text containers and their parent views can grow as text scales. For
UILabel
, setnumberOfLines = 0
so the label can expand to multiple lines as needed. -
Provide scrolling if needed: If the text is expected to be long, embed the text container inside a
UIScrollView
so all content remains reachable.
Example
The following screenshot highlights a text truncation violation in an Android app:
Errors
- The
TextView
uses the correct font unit (sp
) for scalable text, but its parent view has a fixed height of273dp
. - The fixed height restricts the
TextView
from expanding as text size increases, causing truncation.
Fix
To fix this violation:
- Change the parent view’s height from
273dp
towrap_content
to allow it to expand with the text. - Set the
TextView
layout_height
towrap_content
. - If the text is long, place the
TextView
inside aScrollView
so users can access the entire content.
References
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!