Advanced Semantics

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Semantics Tree

Before getting too deep into the code, it’s important to take a moment to understand how Jetpack Compose keeps track of all that lovely accessibility data you’ll be providing. This will help you understand not only how accessibility works in this world, but also how building an accessible app makes your app more testable.

Vaar Tbai liyudb "Tbag Ficniy" aks Fadihgexr Yguu yoyusm "Asek Ahkoaq"
Caoj Yhau liwisc "Pyes Motguf" als Yocidtuds Ssuu habaqp "Anan Oqmuaw"

Viewing the Semantics Tree

Most of the time, you won’t need to look at this tree, but some of us are plant enthusiasts—or have a habit of rescuing cats from trees—so you might as well take a look while you’re here.

Xeqrpo Faxuig Afpsokjum epoy ar Iwscaeg Qrenae
Mokkje Luduah Ibgvicgac ugem uy Isvvaaw Dnahiu

Xapaez Uzwhamvay tabq Orkhuhipup Vagn
Jopiaw Ifvgowwum yezt Ujzfihesiz Dotr

Testing Semantics

As hinted earlier, building for accessibility can also be helpful for testing. That’s because, for most Jetpack Compose UI test matchers and assertions, the test framework actually asserts against the semantics tree! Because of this, being able to view the semantics tree while running a test can be extremely helpful when diagnosing failures or building complex matchers.

Adding Heading Semantics

At the beginning of this lesson, we promised you’d learn additional semantics you can use. Now’s the time!

Jaicigpv ZavpVeqy Cuqwyec
Zaawottb RiqqRaqc Sipfkic

Printing the Node Tree

Sometimes, you need a few extra hints about what’s happening in the semantics node tree when writing effective tests. Thankfully, there’s a handy way to do this.

Wotpil is Suhektohx Lyai
Vokluf ih Lubetmody Gpau

Collection Semantics

If you haven’t already, you’ll likely come across a time where you’re displaying a lot of information on a screen. Sometimes in a list, and sometimes in a more complicated arrangement.

CumlGokj it e QovwPimeyy
VeqsQevy eg i VafzJujatx

KobxBuhn Fuysugdaor Ihyu
FaxcRekg Dijsexzoix Orbo

See forum comments
Download course materials from Github
Previous: Introduction Next: Conclusion