Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 9 months ago

Desserts!...now I'm hungry

react, tailwind-css, framer-motion
Edwin Cheng•360
@edwinc73
A solution to the Product list with cart challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I did some more learning to understand why framer motion wasn't doing the exit animation

What challenges did you encounter, and how did you overcome them?

not really any challenges, it was quite straight forward. just took time to implement. I did this in about a day.

What specific areas of your project would you like help with?

I want to know how to make the clickable elements more keyboard accessible. using button and having divs as a child component is not valid

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Teodor Jenkler•4,040
    @TedJenkler
    Posted 9 months ago

    Hi @edwinc73,

    Nice project! I have some feedback regarding how you can approach button creation:

    Okay, so there are two ways to approach this. The first is the hard but fun way: you create a button and then place content inside it using absolute positioning. It’s really enjoyable, but it can be a bit frustrating at times and arguably just a waste of time haha(You will learn a lot trying to solve this but don't use this as a real solution).

    The second, and more practical, approach is to create a custom button using <div> elements. To ensure accessibility, you should:

    Add role="button" to indicate it's an interactive element.

    Use tabindex="0" to make it focusable via keyboard navigation.

    Add aria-pressed="false" (or aria-pressed="true", depending on the state) to communicate its state to screen readers. Here's a quick example:

    <div role="button" tabindex="0" aria-pressed="false" onclick="handleClick()" onkeydown="if(event.key === 'Enter') handleClick()" style={} Custom Button </div> This approach ensures that your custom button is both functional and accessible. It’s easier to manage and maintain, especially in complex projects. (It is the correct way.)

    Keep up the great work!

    Best, Teodor

    Marked as helpful
  • Svitlana Suslenkova•5,340
    @SvitlanaSuslenkova
    Posted 9 months ago

    You can just add grid to the button and not create div inside it.

    Marked as helpful

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit 1st-party linked stylesheets, and styles within <style> tags.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub