Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Advice Generator Using Vanilla JS

#accessibility#fetch
Sara 70

@skuenzi

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


When using :active :hover and :focus states, what's your method for maintaining accessibility while keeping the design clean? Whenever :focus is activated, it remains until you click outside the element. How do you prevent that?

What is your method for file organization? I'm used to having a src folder, but the index has to be in the root for most hosting sites.

Community feedback

@elidrissidev

Posted

Hey Sara 👋,

Congrats on finishing your first challenge!

To address your questions:

  1. There is a workaround to the focus issue, and it's the :focus-visible pseudo-class, quote from MDN docs: The :focus-visible pseudo-class applies while an element matches the :focus pseudo-class and the UA (User Agent) determines via heuristics that the focus should be made evident on the element. (Many browsers show a "focus ring" by default in this case.)

But keep in mind that this is not supported in Safari, so you'd want to have a fallback style using the regular :focus as mentioned in the link.

  1. For code organizations, I usually use a bundler such as Parcel, that way I can organize my files under src folder and also get to use modern javascript features. When ready to deploy, Parcel compiles everything together under a dist folder by default which you can configure to be the root folder used when deploying to a service (I know vercel and netlify have it, not very sure about github pages).

I hope this answers your questions, feel free to ask if you have more and good luck!

0

Please log in to post a comment

Log in with GitHub
Discord logo

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