Skip to content
ExamplesOpen editor ↗

tlhalosaKarolo

→ describeElement()

Describes one named part of the canvas.

tlhalosaKarolo(name, description)

Where tlhalosa speaks about the whole canvas, tlhalosaKarolo speaks about one part of it — several shapes that mean something together. Two overlapping circles might be an eye; a few lines might be a house.

It takes two strings: the name of the part, then its description. A screen reader reads them as a list, so someone who cannot see hears the picture’s parts rather than one long paragraph.

A part, not an element. The word “element” here does not mean an HTML element — it is a part of the picture. Bopa uses karolo, the word already in its own examples, rather than the HTML one.

NameTypeDescription
leinamokwaloThe name of the part, such as 'Letsatsi'.
tlhalosomokwaloThat part, in words.
A picture with two named parts
tiro setaLoeto() {
  thalaKanefase(400, 240);
  bokamorago(150, 200, 240);
  tlogelaMothalo();

  tlatsaMmala(250, 210, 80);
  thalaSediko(320, 60, 90);
  tlhalosaKarolo('Letsatsi', 'Sediko se se serolwana se se kwa godimo ka fa mojeng.');

  tlatsaMmala(90, 160, 90);
  thalaKhutlotharo(200, 90, 120, 200, 280, 200);
  tlhalosaKarolo('Thaba', 'Khutlotharo e tala e e emeng mo tlase ga letsatsi.');

  tlhalosa('Setshwantsho se se bonolo sa thaba e tala ka fa tlase ga letsatsi le le serolwana.');
}

tlhalosa