Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

Tip-Calculator-App Vanilla JS only mobile solution

devjakov•210
@devjakov
A solution to the Tip calculator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I am really tired and would like to move on to other projects to practice my JS so I am skipping the part where I would build out the desktop style :D

In this one I learned the importance of having tidy code haha, my code is chaos but it works

In the future I will definitely focus on creating functions step by step and writing more pseudocode in advance.

There was also many bugs I did not anticipate and proved good challenges!

Cheers, Jakov

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Raymart Pamplona•16,040
    @pikapikamart
    Posted over 3 years ago

    Hey, awesome work on this one. Like what you said, only mobile but it looks great though^^

    Also, you can have a look at other solution on this one if you go to the challenge hub for this challenge. There you can see their structuring and how they approach this challenge.

    Some other suggestions on the site would be:

    • Avoid using height: 100vh on a large container like the body tag as this limits the element's height based on the remaining screen's height. Instead use min-height: 100vh, this takes full height but lets the element expand if needed.
    • Also don't add width: 100vw as this adds an extra horizontal scroll since this doesn't account the scrollbar's size and it just create a horizontal scrollbar.
    • Website-logo img should be using the website's name as the alt like alt="splitter". Remember that a website's logo is meaningful so always make sure it uses the proper alt value.
    • Also, it would be great to use:
    <header /> #nest the website-logo
    <main /> #nest the rest of the element
    

    This way, element will be inside landmark elements.

    • Your for attribute on the bill-label is currently incorrect, check that one out.
    • Those icons on the input you could add an extra aria-hidden="true" attribute on it so that it will be totally hidden for all screen-reader users or in general, if you have an image that is just decoration, hide it always by using alt="' and aria-hidden="true".
    • The select tip could be a heading tag or a legend if you implemented using radio buttons but not a label.
    • Use button instead of input type="button".
    • Since you are using only button in here, you would need to have an aria-live element that will announce the certain button has been pressed or selected, because button alone is not informative.
    • Your custom-input tag lacks an associated label tag on it. Since there are visible-label, the label would be a screen-reader only label, meaning it would make user of like sr-only class. The text-content should describe what the input needs like the value on the placeholder.
    • The text Tip Amount and Total could use a heading tag since it describes what the section is about.
    • The resulting number is not a heading tag, because by making one, it doesn't convey any information right, p tag would be great.
    • Also, I almost forgot. A page must have a single h1 on a page. Since there are no text-content that are visible that could be h1, you will make the h1 screen-reader only text. Meaning this will be hidden for sighted users and only be visible for screen-reader users, search about sr-only stylings and see how it is used. The h1 text should describe what is the main content is all about, this h1 would be placed as the first text-content inside the main element.Have a look at this simple snippet about screen-reader only h1 I already included comments in there^^.

    Now, you might find yourself confused for some suggestions that I made but that's fine. if you can't implement those right away, that's fine, being aware of those is the important thing.

    If you have any queries, just let me know okay. Aside from those, great job again on this one.

    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 all CSS, SCSS and Less files in your repository.

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.

How does the JavaScript validation report work?

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

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

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

Log in with GitHub