Design comparison
Solution retrospective
The problem that I'm having is that when I click the button , I have to press it twice to go to the next advice Is the api the problem, or there's a different reason for it?
Community feedback
- @fernandolapazPosted 7 months ago
Hello, regarding your question:
On the API site https://api.adviceslip.com you can see the note "Advice is cached for 2 seconds. Any repeat-request within 2 seconds will return the same piece of advice."
That is the reason.
I hope this clarifies your doubt.
Greetings,
1 - @0xabdulkhaliqPosted 7 months ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have a suggestion regarding your code that I believe will be of great interest to you.
FEW IMPROVEMENTS :
- " I have to press it twice to go to the next advice Is the api the problem, or there's a different reason for it ? ", No your solution works right! This issue is cause by the API itself. Sometimes it will generate the existing advice (it doesn't know existing ones, so it generate the same thing multiple times)
- Currently
<button>
element to generate advice is not accessible because it does not have any text content or anaria-label
attribute that describes its purpose or function. Thealt
attribute on the<img>
element inside the button is not an adequate replacement for an accessible name.
- To make the button accessible, you should add an
aria-label
attribute to the<button>
element that describes its purpose or function.
- Here's an example:
<button aria-label="Click to generate a new advice"> <img src="images/icon-dice.svg"> </button>
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
1@turboo-syPosted 7 months agoHello My Friend Words cannot express the way I appreciate you To Be Honestly , I'm not very experienced in this domain, I take advice from other people and apply it to my situation.@0xabdulkhalid
0
Please log in to post a comment
Log in with GitHubJoin 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