Coder Social home page Coder Social logo

Comments (2)

georgewrmarshall avatar georgewrmarshall commented on September 26, 2024

@wachunei please add correct steps to reproduce

from metamask-mobile.

wachunei avatar wachunei commented on September 26, 2024

I have more details about the issue and an example to reproduce.

The issue is: Button components base component ButtonBase does not have default props for accessibility, these are accessibilityRole: 'button' and accessible: true.

Currently a simplified snapshot of every Button of the component library would look like this:

<TouchableOpacity>
  <Text
    accessibilityRole="text"
  >
    Click me!
  </Text>
</TouchableOpacity>

This won't work with tests like screen.getByRole('button', { name: 'Click me!' }) because the button does not have the props.

This is a working example snapshot:

<TouchableOpacity
  accessibilityRole="button"
  accessible={true}
>
  <Text
    accessibilityRole="text"
  >
    Click me!
  </Text>
</TouchableOpacity>

In the branch temp/button-a11y-tests I have added this file app/component-library/components/Buttons/Button/foundation/ButtonBase/ButtonBase.rntl.test.tsx with examples of failing and passing tests.

The file includes a comparison with the deprecated StyledButton component that behaves correctly regarding a11y tests.
The tests include snapshots to compare the default rendering of the props missing https://github.com/MetaMask/metamask-mobile/blob/temp/button-a11y-tests/app/component-library/components/Buttons/Button/foundation/ButtonBase/__snapshots__/ButtonBase.rntl.test.tsx.snap

from metamask-mobile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.