Possible way of adding Text reader accessibility?

Hello All,

I am trying to think of a way to add text reader accessibility to text so that a screen reader can pick it up and … well … read it.

After some experimentation I have found the below code gets picked up and read by the reader. I wanted to check with the PC devs to see if

  1. this is a good way going about it or if they see some pitfalls I am not aware of
  2. share this with the devs in hopes to one day something like this gets implement in pc and is automatically applied or through a check box.
var GameManager = pc.createScript('gameManager');

GameManager.prototype.initialize = function() {
  const newImg = document.createElement("img"); 
  newImg.alt="Hellos";
  newImg.ariaLive = "true";
  newImg.focus = 'true';
  document.body.appendChild(newImg);
};

GameManager.prototype.update = function(dt) {

  if (this.app.keyboard.wasPressed(pc.KEY_LEFT)) {
      const newImg = document.createElement("img"); 
      newImg.alt="new Text";
      newImg.ariaLive = "true";
      newImg.focus = 'true';
      document.body.appendChild(newImg);
  }

};

2 Likes