Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 1 year ago

article-preview-component

Mario Kreitz•310
@mariokreitz
A solution to the Article preview component 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 really tried hard to follow the semantic html5 structure and tried out the aria attributes


  
    
  
  
    
      Shift the overall look and feel by adding these wonderful touches to furniture in your home
    
    
      
        Ever been in a room and felt like something was missing? Perhaps it felt slightly bare and uninviting. I've got
        some simple tips to help you make any room feel complete.
      
    
    
      
        
          
        
        
          Michelle Appleton
          28 Jun 2020
        
      
      
        
          ${getSVGForShareOption("share")}
        
      
    
  

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

the outsideClickEventHandler.. with a little bit of help during the debuggin from chatGPT i figured out

&& target.id !== "share-button" && !target.closest("#share-button svg")

and here is my solution =)

function closeShareMenuOnClickOutside(event) {
  const target = event.target;
  const shareMenu = document.getElementById("share-menu");
  const isClickOutsideShareMenu =
    !shareMenu.contains(target) && target.id !== "share-button" && !target.closest("#share-button svg");
  if (isClickOutsideShareMenu) toggleShareMenu();
}
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 Mario Kreitz'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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

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