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

Bubbling, Modals and RegEx. Oh My!

webpack, sass/scss
Jon Wright•160
@Dr-Wrong-Mo
A solution to the Interactive comments section challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I go into more detail with my challenges in my README file that you can find in my GitHub repo, but here are the highlights.

  1. The dialog element that I used for my Delete Modal was showing up on the page when it should have been hidden by default. This was due to an unexpected side effect of using Flexbox on the dialog element.
  2. I also had an issue with formatting the Dialog modal due to property inheritance. I had set margin and padding to zero for everything, which caused issues with the Dialog.
  3. It was easy enough to loop through the data and input top level comments on the page, but dealing with comment replies became more challenging. This is a challenge that Angular has always made easy for me, so it was fun to attack this without a framework.
  4. Another issue I've never dealt with because I've traditionally used frameworks: I couldn't get event listeners to work on elements that were being loaded to the page dynamically. I had to study up on event bubbling to find my solution.
  5. The last noteworthy issue I had was related to username callouts in the comments (e.g. @jonwright). I wanted to be able to change the formatting of these callouts, no matter where they were in the comment, but I didn't want to inadvertently change the format on email addresses. For this issue, I had to finally study up on regular expressions.

This project was much more challenging than I expected at first glance. I learned a ton, and I feel like my code improved a ton as I went.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • jonathan•50
    @Jonathanmeij
    Posted about 3 years ago

    Great solution!

    I found two thing that could be fixed. When you click on the arrow image, the reply editor is placed on top of the comment. And maybe you can try to make the reply editor disappear when you click it a second time, now it keeps adding new editors.

    Rest of the site looks and works very good!

    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