Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 23 days ago

Newsletter-sign-up-form-with-success-message

pure-css
Jaya Sharma•110
@jayasharma5372
A solution to the Newsletter sign-up form with success message 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'm quite proud of successfully implementing the different states of the newsletter form: the default view, the error state with specific messages, and the success message display. Getting the responsive design to work smoothly, transitioning from the two-column desktop layout to the mobile view (with the illustration on top), was also a key achievement for me. I paid attention to details like the hover states on the button and the layout of the list items. Next time, I might spend a bit more time upfront planning the CSS structure, perhaps considering a methodology like BEM more strictly from the outset, even for a smaller component like this. I also think I could explore more efficient ways to handle the DOM manipulation for switching between the form and success views, perhaps by creating reusable functions if the component were more complex. I'd also consider how to better integrate a more complex SVG illustration if the design demanded it, ensuring it scales and positions correctly.

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

One of the main challenges was the responsive layout switch, particularly ensuring the illustration part behaved correctly (e.g., changing from a side panel to a top banner with appropriate border-radius adjustments). This required careful use of Flexbox and media queries. I initially had some issues with the illustration's dimensions and border-radius on mobile, which I resolved by adjusting its flex properties, setting a fixed height for mobile, and ensuring the border-radius was applied correctly to the new top-banner orientation. Another challenge was ensuring the error messages displayed correctly next to the label without disrupting the layout too much. I used a flex container for the label and error message to keep them aligned. The JavaScript for validation and toggling error states needed careful thought to ensure it was clear and didn't lead to repetitive code. I overcame this by breaking down the validation logic and using clear class toggles.

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

I'd appreciate any feedback on the following: JavaScript Efficiency & Structure: Is the JavaScript for handling form submission, validation, and state toggling (form vs. success message) clean and efficient? Are there more modern or robust patterns I could have used? CSS Best Practices for Responsiveness: While the layout works, are there any more elegant or standard ways to handle the desktop-to-mobile transition for this type of component? Any tips on managing the illustration's aspect ratio or display more effectively across views? Accessibility: I tried to use semantic HTML and appropriate labels. Are there any further accessibility improvements I could make to the form or the success message? For instance, regarding focus management after submission or when an error appears. HTML Semantics: Is the HTML structure as semantic as it could be for this component? Any general feedback on code organization or potential improvements would be greatly appreciated!

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Jaya Sharma's solution.

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.