FLUID-6760: The self voicing enactor throws error when using UIO+ with wikipedia

Metadata

Source
FLUID-6760
Type
Task
Priority
Major
Status
Open
Resolution
N/A
Assignee
N/A
Reporter
Cindy Li
Created
2022-12-20T14:08:35.310-0500
Updated
2022-12-20T14:55:13.347-0500
Versions
N/A
Fixed Versions
N/A
Component
  1. Self Voicing

Description

To reproduce:

1. In the UIO+ source code, modify "uioPlus.enactor.selfVoicing" in enactors.js to remove the `distributeOptions` block that disables the page level reading in the self voicing component;
2. In a terminal, run "npm run build". Install the built UIO+ in Chrome.
3. In Chrome, open https://en.wikipedia.org/wiki/Main_Page, turn on text-to-speech, click "play" button;

In the browser console, `lang is undefined` error is thrown.

After a debugging, this error is originated from this line in Orator.js because `parsedBlock` is an empty array so `parsedBlock[0].lang` is `undefined`. The reason that an empty array of `parsedBlock` is pushed into `that.parseQueue` is from this block. On the wikipedia page, many text blocks fit into this condition `(lastQueue.length && lastQueue[0].lang !== lang)`. Those blocks have text but in a different language from what's defined at the page level.

This issue is also filed in the UIO+ repository at https://github.com/fluid-project/uio-plus/issues/43