Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
How can I make a screen reader read out a mix of text and components?

I have the following array:

const row = ['I agree to the', {}, 'and', {}];

Where the 2 objects are React components that make the text a link.

I then render this text like this:

<WrapperComponent>
    {row}
</WrapperComponent>

I get the following sentence rendered:

I agree to the Terms of Service and Privacy Policy

And if I turn on the screen reader, the whole sentence gets focused and read out.

My question is whether I can do something to make the screen reader read the whole sentence first, and then have the first link element "Terms of Service" focused if the user swipes right once, and "Privacy Policy" if he swipes right twice.

about 4 years ago · Santiago Gelvez
3 Respuestas
Responde la pregunta

0

you can create a class for those if you want them to be programmatically focused this class will use Refs in DOM Elements

class CustomTextInput extends React.Component {
    constructor(props){
        super(props);
        this.component= React.createRef();
    }
    render() {
        return <div ref={this.component} />;
    }
    focushere(){
        this.component.current.focus();
    }
}

so you can add an eventlistener based on user's swipe gesture so you can just access the class and call the focushere() function

about 4 years ago · Santiago Gelvez Denunciar

0

The following causes the entire checkbox sentence to be read first, then a swipe right says "terms of service". However, the next swipe right says "and" and then the next swipe right says "privacy policy", at least on ios. I don't have an android device to test it on. So that's close to what you want. If your two components are links, they should cause the swipe to move to them.

<label>
  <input type="checkbox">
  i agree to the <a href="#">terms of service</a> and <a href="#">privacy policy</a>
</label>
about 4 years ago · Santiago Gelvez Denunciar

0

We are assuming that your <WrapperComponent> is a labelled checkbox, hence another interactive element which can receive focus.

MDN discourages using interactive elements inside labels:

Don't place interactive elements such as anchors or buttons inside a label. Doing so makes it difficult for people to activate the form input associated with the label.

So, while it might work in some screen readers/browsers, you should avoid it.

MDN further suggests the following solution (adjusted to your text):

<label for="tac">
  <input id="tac" type="checkbox" name="terms-and-conditions">
  I agree to the Terms of Service and Privacy Policy
</label>
<p>
  Read our 
  <a href="terms-of-service.html">Terms of Service</a>
  and our
  <a href="privacy.html">Privacy Policy</a>
</p>

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda