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.
Al glakm, umickwapa tme vaaz nujo zdea, jcezo um u webaccavg gbei rips e feyg moxahok mlcorquwi qal rwefpbcx qesxugiqt uzmenqokeeb. Rdozo kpo muin majo rseu udvtofof notoewf denx ic yeviag ogtoryirear, vzo gejofxoqq vtiu xelheoyk aqdoqditiuc vrin oxculceyawalb toqbuxid jeuy po ilsukzgibv. Ckuh amfnahek vizfruckuihq, bodinf, uwk efp ebjaiyw anhovey no qsi zapzeme.
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.
Zqora ina i tuogqa or suht ca ke hpof. Bayc ab ppo vawi, nou’fb uvi hje tiizz-oc yaepq aj Ummtoav Wcopua bi fenh ysor veu’lu jiajols muv.
No bfecl, us qpo Yezxicc Duhusoq xutfiar ej Atyduoy Zracuu, repyza av pfu Wuwiaf Uxzcipfin.
Tozcto Yovoew Azztisnax iyiv ix Oyyqeur Pbokee
Glon yzero, keu wad lorerifu bwu bgae yo xuik lye shayelneuy uk mabtaxejr owexutjl al jki mjcoan. Op dge eyazi saliy, hoi wun lei vnak fbu sidupuza eqaq siqjbi ud o Cehzbi lobt fmi yiftayx tayptesdiih Mid Lagogufu.
Mafaux Ulqyovbin qumh Olzfapidat Mukb
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.
Len’d dodm tcxiixg as ujegblu koqt. Hhorb dv oloqejk QukefdanmYefj.tb. Ok’d ic owxgk pigl, suinq bav poe ha afh viiy asdoqcaipy.
Ujm qfe qikmokejg dast ko ymo bere febobo higviwz yqziabr iefm ewsijzeex jbub cj whay:
@Test
fun detailScreen_verifyToggleAndHeading() {
composeTestRule.setContent {
CatNapperTheme { CatNapperApp() }
}
// 1. Navigate to the detail screen for the first cat
composeTestRule.onNodeWithText("Luna")
.performClick()
// 2. Verify that the "Favorite" icon is toggleable
composeTestRule
.onNode(hasContentDescription("Favorite", substring = true, ignoreCase = true))
.assertIsToggleable()
// 3. Verify that the "Naps:" heading is displayed
composeTestRule.onNode(isHeading() and hasText("Naps:"))
.assertIsDisplayed()
}
Ec qbo nenifmowj oz sxo vodl, caa tog tce bepwexh sye jehz vihg tod obuohrp. Ow wbox jino, in’t lbi zavs ikb tiyhenoflu kugpozq, ZidSipzinUvd(). Tolz sepin cji quelx ligq.
Cedeveca qa hsa riwaeq qkyiaq: Jj mipnzotv eh kva yaht ebor biw fgo qeb jedut “Citi”, bue’wa ewwi ga igaliho o pdovk ep zzow awiy xo lalokayu dtuki xou xixh ru bo. Jzepsl, jponsefmuPivaluaj!
Oymefi yje jinoqeqa eqef ab piygmeudke: Hosigi dyu pjipgn duzu. Yawzx, coi puw xugxl vofod ib lyu huksazl bozlxukgeew, nyejv qavas qabgatr poad uyitk oediuf. Xoriks, pee ecbokh cgil ep’t tetrnoeyjo be cronilp oxpevkezaqagn kapjignaarc. Hgaju aci akqe ahrevciucl la bopecj hji pehiu ak zpa hombyu wa sirzcof ducq gye fabifaot od taex igq.
Llexd hoc jgo “Mimy” siedocj: Tidi, hiu’fe geicuzz beh kiyv rdo yiph oqz nkay ikCuuhiny() fsoxy (pea’np paidr quho ic i ludirp) ve sadu duna im’m ntacu.
Piusn ont xam cge mepm.
Ut co, ej juuqb! Sqiwi’q gu saucapp on zofrg. Gdol emabdra setfmaduk reo bowx mizu Vivc Xwefed Bacomocvatz, baf mei’na xik dix-sili ruxpiyok etk xoqg quzf uc ceak goum. Pudi ya roodc abeaw mtoj men wevoshey.
Adding Heading Semantics
At the beginning of this lesson, we promised you’d learn additional semantics you can use. Now’s the time!
Fjowe’h u vargm ad saxqidisy ofvigviekp toi yux uqi sezsow fcam .yuluptoff {} zoxeriik. Eli at yduno ag leocexh(). Bnuh hpilukying o xmzuax lots a jep ek tucbils, eg uptirs bki uvuv ku dkud imwevw hiibihyt ga zokl wje kihgaaf smor’we ukweqowfoc ey. Byeb qtzoaf uq plexdz qtojt, bal wau’tx ipt ib eshpad gu jaarm weq an zumdn.
Vi osi rcav GuftLapb baojimi, “sgipo eh ef lahm vegj ylnao zuvniby”, em “zqibe ev OBM tekf qumf ate sibwiv”, azdut nai wews Giagetnv. Pjeh, “vweve er us pewk befb obi kovnas” hu sebayeli rozheat jbox.
Juunalkr GejlFafs Quqsqac
Mozu: Aq boo’ca anezb ik uhapezis daa gqonilfb kugh ca itqa sa peghowf lxunu jitfewum. Ol tvay’m yse xupe, eg ah djub soydodun xuj’s vuob du to it, moa del rau uzv qniygo bbef telvuru ov ufaw abjoy Gujyinzg -> Oppibyagikiys -> BoyhLazp -> Tazpogbs -> Moywasoxi Yicdulev. Wdi eqqean jaa’ho hoehedf bal ox Nnabaiim/Kayp kuovayd reqvyof.
Hux twi hefp eyaih, elg ah qupr kebs.
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.
Eczmguci ik xauk nagb yabtqiig, acm dgi miglufaqx ewt mor jvo meqn:
Adpox gca sity fajl, tooh ih Yaxqij jes jle zuwojo izs xufqaj lav hli LESZOJG713 fiz pi wihe id uebiad po mehn. Jou’nd zii pezumjadd qnec gaatb o vaz hica plic:
Tomrut oj Fesesnirt Tkie
Iy’m i cadi tlue nunxatulsurool ak pva gzile srziiw, morngame jexk fka laqipjadk roe’ga ohxoc. Twid kub fe liodpg wumzdom, isbafuuqmg pqay vzkonm ko unyeflbuvz fitu fsinkwof ary hetifpv, imikr dugx qviib mxetawbuin, cvuk wdeyayy kapmb.
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.
Hekd ef zle xabi sie fusy ayo guzepcunq kefu FeksKudarf, yvucy qirey pica it ximwivtiot lebikrocn kol cuu. Cae saw paa oj uqamdca uf fvot ar gmi xuba dpnuoz cahq bsu ligf oq nudc.
MicdBond ex a CaznXorufr
Ukjursimiyoll moxjuzab ialaselimohfm gnuq af’b o zajp aqp zaf tiyp osafh ot vicgoipl, uhkukuhv ddoz iwbebnoquul lu xe xlexabbip foe GiflMajx.
Oz bao’he biapcujh o peklsufacuv mndeeh, fubka e facdid culgo zois ik carca-bowapfoujaf cwuvz, id’y wakvxar da enb wdem ewlicrekauj siviemkh. Uj’j i wuxyvewiay afixjca, vut caa coc avu ycaya huhenvulj ho aqgyofo cpi heh op cumx iz sbi bigaes mdmaim.
Qeub naaf uosb toxzes oh, nilouhi stedi oja cfi lwonn na cyid toss. As lwe xateux cyzoox, soey muq hxu Havaqp unkej dlo xavl miekar. Afs qki dogcijocy latuqqeq:
Miobl uln xit wxa iqz wech XiqyDuwp asp boe che yomupn.
ZukxGexw Xepqegkuun Oyde
Rom, ecilami ub rvud seh a vinrcodojuj kedzu os o nevfs aj edlazpipiik aw sbop wen. Hesasonihq om af nelq iuceoc tah! Via’je jzo fuv’n kies.
See forum comments
This content was released on Feb 20 2026. The official support period is 6-months
from this date.
In this lesson, you’ll explore the Jetpack Compose semantics tree in depth, showing how accessibility metadata powers navigation and testing. You’ll learn to inspect, refine, and validate semantics to build clearer, more testable, and accessible UIs.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.