Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
Component that is made for hiding content from screen while still have screen readers read it out is behaving weirdly

I have a very simple component that does two things:

  1. Prevent render of its child components if there is no screen reader enabled
  2. Render its child components if there is a screen reader enabled, but visually hide them from the UI so that they're only visible to the screen reader

The component looks like this:

const VisuallyHidden: FunctionComponent<ViewProps> = ({ ...rest }) => {
    const screenReaderEnabled = useScreenReader();

    if (!screenReaderEnabled) return null;

    return <Hidden {...rest} />;
};

const Hidden = styled(View)`
    position: absolute;
    clip: rect(0 0 0 0);
    overflow: hidden;
    height: 1px;
    width: 1px;
`;

export default VisuallyHidden;

When I try to use the component like this:

<VisuallyHidden>{linkButtons}</VisuallyHidden>

The screen reader does not read out the linkButtons, but when I remove the CSS that hides them from the screen, the screen reader reads them out. So my question is whether my CSS is making the screen reader not read them out for some reason? I know that they are being rendered because I can see them once I remove the CSS that hides them, so the screen reader should be able to reach them.

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda