Code Monkey home page Code Monkey logo

project-survey's Introduction

Survey form with React ๐Ÿฃ

I've built a multi step survey about sushi using React.

The problem

The main task was to build a survey form containing questions with different input types. When the user presses the submit button the form will disappear and a summary of the user's submission will be displayed.

I did the form with multiple steps where each step represented a different page (the first page, the respective questions and the summary at the end). I first began to figure out the flow of the React components starting from App.js. I decided to make a Form component the main component and to simply mount the Form component in App.js. I then created components for the different steps. I decided to use as few React useState hooks as possible and declared them in the Form component so that I could access it all in one place (this made it easier to for example access the user's inputs for the summary). To only display one question at a time I used conditional rendering with a button to progress to the next question (and a previous button to move backwards).

I also added HTML input validation attributes to the form and a function to access and check if the required attribute was true. If not, the user would get a message with a prompt on what to do. At the end I applied the styling.

If I had more time, I would have added more questions with different input types (such as a range slider and a checkbox) and a progress bar to show the user how much of the form is left. Also, I would've wanted to show different questions depending on a answer to the specific question. I would have liked more time to do a more elaborate styling of the form and its input types as well, but given the time frame of the project's completion the styling wasn't a priority.

Accessibility testing

Here's an overview of the testing I've done.

  • The page is responsive and tested on different devices accessible to me in Chrome Dev tools
  • The page works on different browsers; Chrome, Edge and Firefox
  • It's possible to navigate the page using only the keyboard (tab, arrows and enter)
  • The page has been run through HTML validators; Lighthouse in Chrome Dev tools
  • Ran an audit using WAVE (wave.webaim.org); the page received no errors or contrast errors
  • The content of the page is still readable and understandable without the CSS; used the Google Chrome Web Developer tool to remove all the CSS
  • The page has been tested with a screen reader, but with not so desireable results. After a bit of googling it seems like there's an issue with multi step forms with no easy solution to. As a quick fix I added some aria attributes in App.js to mitigate this a bit but it is still not the most optimal solution. If I had more time, I would have tried to solve this.

View it live

For my live project, see this link: https://quizzical-nightingale-6208b3.netlify.app/

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.