<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anuar Shaidenov</title>
    <description>The latest articles on DEV Community by Anuar Shaidenov (@anuarshaidenov).</description>
    <link>https://dev.to/anuarshaidenov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F768696%2Fbe400c05-e052-40a3-b8f0-22fed60cb7b4.jpeg</url>
      <title>DEV Community: Anuar Shaidenov</title>
      <link>https://dev.to/anuarshaidenov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anuarshaidenov"/>
    <language>en</language>
    <item>
      <title>Create Repeating Google Calendar Event for Last Working Day of Month</title>
      <dc:creator>Anuar Shaidenov</dc:creator>
      <pubDate>Mon, 02 Sep 2024 07:54:27 +0000</pubDate>
      <link>https://dev.to/anuarshaidenov/create-repeating-google-calendar-event-for-last-working-day-of-month-31g4</link>
      <guid>https://dev.to/anuarshaidenov/create-repeating-google-calendar-event-for-last-working-day-of-month-31g4</guid>
      <description>&lt;p&gt;&lt;a href="https://endmonthevent.vercel.app/" rel="noopener noreferrer"&gt;End of Month Event Creator&lt;/a&gt;: A Simple Solution for Scheduling Recurring Monthly Events in Google Calendar&lt;/p&gt;

&lt;p&gt;If you’ve ever struggled with setting recurring events for the last day of each month in Google Calendar, you’re not alone. As a 9-to-5 guy that keeps calendar I want to keep track of the salary day which happens to land on the last day of each month. Until recently, this functionality was noticeably absent, frustrating users who needed to track important monthly deadlines. But now, with the &lt;a href="https://endmonthevent.vercel.app/" rel="noopener noreferrer"&gt;End of Month Event Creator&lt;/a&gt;, there’s finally a simple, effective solution that gets the job done.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;For many people, setting recurring reminders for things like bill payments, monthly reports, or important deadlines is a must. However, Google Calendar doesn’t support recurring events for the last day of each month — a limitation that leaves users manually scheduling events one month at a time. This is where the End of Month Event Creator comes in.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://endmonthevent.vercel.app/" rel="noopener noreferrer"&gt;End of Month Event Creator&lt;/a&gt; is a new, open-source app that integrates with Google Calendar and lets you create events that automatically recur on the last day of every month. Whether you’re scheduling a full-day event or one with a specific time, this app handles it all effortlessly. Once you’ve set it up, you’ll never have to worry about missing those critical end-of-month reminders again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why You Should Try It
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Easy Setup&lt;/strong&gt;: It only takes a few clicks to connect your Google Calendar account and create recurring events.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Open-Source and Customizable.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For developers, the open-source nature of the project offers a great opportunity to contribute to something useful. Whether you want to add new features, improve existing ones, or simply explore how the app works, the code is free to use and extend.&lt;/p&gt;

&lt;p&gt;If you’re interested in the code behind the app, you can also explore the GitHub repository &lt;a href="https://github.com/anuarshaidenov/end-month-event" rel="noopener noreferrer"&gt;here&lt;/a&gt;. It’s a great resource for developers looking to contribute or expand on the app’s capabilities.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How I redesigned my portfolio, from start to finish.</title>
      <dc:creator>Anuar Shaidenov</dc:creator>
      <pubDate>Sat, 28 May 2022 13:39:15 +0000</pubDate>
      <link>https://dev.to/anuarshaidenov/how-i-redesigned-my-portfolio-from-start-to-finish-4h8</link>
      <guid>https://dev.to/anuarshaidenov/how-i-redesigned-my-portfolio-from-start-to-finish-4h8</guid>
      <description>&lt;p&gt;I made my first &lt;a href="https://anuarshaidenov.github.io/portfolio/"&gt;portfolio&lt;/a&gt; about 7 months ago. I loved it. It was simple and static, and the design was really lovely. I got the design from the BootCamp that I was enrolled in and made the website with HTML, SCSS, and some JavaScript. Not too long ago I decided it was time to change it to my liking, make the website more dynamic and make use of the knowledge that I gained.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step one: Design
&lt;/h2&gt;

&lt;p&gt;I'm a front-end developer and I always loved designing, following the fundamentals, and using beautiful color schemes. The first thing I did was to decide on the color scheme of my portfolio and choose fonts. After doing some research and figuring out what I wanted this is what I went with:&lt;br&gt;
Color scheme.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d_TYsOaq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n42n1p8kax3a3lkr3r0f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d_TYsOaq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n42n1p8kax3a3lkr3r0f.png" alt="Color scheme" width="668" height="228"&gt;&lt;/a&gt;&lt;br&gt;
Very minimalistic and simple color scheme, I didn't want to overcomplicate it.&lt;/p&gt;

&lt;p&gt;The font that I chose was also very simple: &lt;em&gt;Roboto&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, I am not a designer, so when it comes to it I just operate on vibes and whatever happens, happens. The first iteration of it looked like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fy9S5jOA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8bw4p8lyu3bah01rpt47.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fy9S5jOA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8bw4p8lyu3bah01rpt47.png" alt="The first iteration of the design" width="721" height="1070"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The tool I used to design is &lt;a href="https://figma.com/"&gt;Figma&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It looked very simple and I liked it, so I went with it.&lt;/p&gt;

&lt;p&gt;I like breaking down my designs into components:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qS8FO0X5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2Ap5-jC-G_HiuPrrEu_Eggog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qS8FO0X5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2Ap5-jC-G_HiuPrrEu_Eggog.png" alt="Components" width="880" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see there are some things that I was trying out, the process of designing, I was changing it like 100 times, and when I was developing I changed it 100 more times.&lt;/p&gt;


&lt;h2&gt;
  
  
  Step two: Development.
&lt;/h2&gt;

&lt;p&gt;From the beginning I knew what tech stack I was going to use, it was one of the main reasons I wanted to redevelop my website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://nextjs.org/"&gt;NextJS&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NextJS, according to the official website is a Full-Stack React Framework. It has a lot of good features, but the main one for me is the Static Site Generation. In short, static site generation makes the SEO of your website more performant, since all the content gets rendered on the server and it gets served as static pages, which makes your websites very performant and easy to read for the SEO bots.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f6WY9pO2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2AXo25dy3La0TZEdFxL4lUqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f6WY9pO2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/1400/1%2AXo25dy3La0TZEdFxL4lUqg.png" alt="Lighthouse performance scores" width="838" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As my first step, I set up the environment and started developing using the mobile-first approach. In this case, &lt;a href="https://tailwindcss.com/docs/guides/nextjs"&gt;TailwindCSS&lt;/a&gt; was really helpful, it made it so much easier to style while developing.&lt;/p&gt;

&lt;p&gt;Pages on the website:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;home&lt;/li&gt;
&lt;li&gt;project details pages&lt;/li&gt;
&lt;li&gt;about&lt;/li&gt;
&lt;li&gt;contact&lt;/li&gt;
&lt;li&gt;blog&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I decided to go with different pages so that every page has one purpose and to keep it very simple. Plus, NextJS makes it really easy to work with pages.&lt;/p&gt;

&lt;p&gt;For the home and project pages, I was going to use a headless CMS like Strapi or Sanity, but a couple of months ago I started learning Ruby on Rails and I decided to make a simple RESTful API to keep the data about my projects.&lt;/p&gt;
&lt;h3&gt;
  
  
  The blog page
&lt;/h3&gt;

&lt;p&gt;For the blog page, I was planning to use the medium API to retrieve the data for my profile. But the API documentation was really complicated and I gave up on it… Until I found the API that made it all simple. Big shout out to the author of &lt;a href="https://github.com/david-fernando/medium-posts-api"&gt;this repository&lt;/a&gt;, they have done a great job retrieving posts for Medium users, God bless.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mediumpostapi.herokuapp.com/?usermedium=anuarshaidenov
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So I used the very handy NextJS feature for the blog page: &lt;strong&gt;Incremental Static Regeneration&lt;/strong&gt;. Basically, it is like static site generation, but on steroids. Every time there are any changes on the server, i.e. I add a new blog post, NextJS would detect that change and rebuild my pages.&lt;/p&gt;

&lt;p&gt;The same thing I did for the home page and the project details pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ruby on Rails API
&lt;/h3&gt;

&lt;p&gt;As I mentioned, instead of using a headless CMS I decided to create my own API. Ruby on Rails is the best and easiest option for that. I created endpoints to retrieve, add and edit the data for my projects, an example response would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Car Booking"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"A web app that allows you to register and reserve premium cars. The project was dne in a group of 5 people. It consisits of front-end and back-end. I was working mainly in a front-end team, leading the teammates and controlling the proccess of the app."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2022–05–23T12:13:03.248Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"updated_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2022–05–23T12:13:03.248Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"image"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://raw.githubusercontent.com/anuarshaidenov/car-booking-service-front-end/dev/screenshot-1.png"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"technologies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"React"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"Redux"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"TailwindCSS"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"Ruby on Rails"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"Authentication"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"CRUD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"RSpec Testing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="s2"&gt;"TDD"&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"repository"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://github.com/DelhinRharl/car-booking-service-front-end"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"live"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://deploy-preview-37--willowy-empanada-95e169.netlify.app/"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Home page
&lt;/h3&gt;

&lt;p&gt;I used the data from the backend to retrieve the data for my projects and used ISR for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step three: Deployment
&lt;/h2&gt;

&lt;p&gt;I deployed the website on &lt;a href="https://vercel.com/"&gt;Vercel&lt;/a&gt;. It is the best option when it comes to NextJS websites. Before doing that I added Google Analytics to the page, and configured my domain.&lt;/p&gt;




&lt;p&gt;I loved the process, I would not say it was simple, it took me 2 months to actually finish the website, because throughout the process I faced a lot of blockers, sometimes I just barely had time to even sit down and do it, the other times the imposter syndrome would attack me out of nowhere. The main thing is - I finished it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now hire me. Please.&lt;/strong&gt;&lt;br&gt;
And check out &lt;a href="https://www.anuarshaidenov.com/"&gt;the website&lt;/a&gt;. And tell me your opinion, don't be shy.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>portfolio</category>
      <category>nextjs</category>
      <category>react</category>
    </item>
    <item>
      <title>FocusEvent.relatedTarget — when and why you might need it.</title>
      <dc:creator>Anuar Shaidenov</dc:creator>
      <pubDate>Sun, 05 Dec 2021 16:39:16 +0000</pubDate>
      <link>https://dev.to/anuarshaidenov/focuseventrelatedtarget-when-and-why-you-might-need-it-1jd5</link>
      <guid>https://dev.to/anuarshaidenov/focuseventrelatedtarget-when-and-why-you-might-need-it-1jd5</guid>
      <description>&lt;p&gt;Last week I was working on a small to-do list app as a weekly project for a BootCamp for web developers that I’m enrolled in. The app is built with vanilla JavaScript, HTML/CSS for the UI. Although it is a “must” to have a to-do list app in front-end developers’ portfolio I’d never actually done it prior to this project and now I can see why people are saying how crucial it is for applying your skills into practice.&lt;/p&gt;

&lt;p&gt;The features of the app were clear and seemingly simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Display list items dynamically&lt;/li&gt;
&lt;li&gt;Save the data in the local storage&lt;/li&gt;
&lt;li&gt;User should be able to add/remove items to/from the list&lt;/li&gt;
&lt;li&gt;User should be able to edit the list items&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wneNfwWQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x1alb4ue5s4l9xruxnru.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wneNfwWQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x1alb4ue5s4l9xruxnru.png" alt="To do list app screensho" width="880" height="599"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---n7TqPHw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfae862mzm4lm6gimeev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---n7TqPHw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfae862mzm4lm6gimeev.png" alt="Code structure for the to do list" width="880" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the code above I used &lt;code&gt;&amp;lt;input type="text"&amp;gt;&lt;/code&gt; to display the description(name) of each task. The reason I chose to use it is to be able to edit the description and listen to the change event.&lt;/p&gt;

&lt;p&gt;Throughout the process of building the app, I didn't really face any issues until I started working with &lt;code&gt;focusin&lt;/code&gt; and &lt;code&gt;focusout&lt;/code&gt; events alongside click events.&lt;/p&gt;

&lt;p&gt;This was my thought process making this feature:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Attach &lt;code&gt;focusin&lt;/code&gt; event listener to the input field&lt;/li&gt;
&lt;li&gt;Apply styles (by adding classes)&lt;/li&gt;
&lt;li&gt;Hide the options button and display the remove button (&lt;code&gt;display: none&lt;/code&gt; and &lt;code&gt;display: block&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;On &lt;code&gt;focusout&lt;/code&gt; event get everything back to the way it was&lt;/li&gt;
&lt;li&gt;Attach the click event listener to the remove buttons&lt;/li&gt;
&lt;li&gt;Remove the clicked item (match the &lt;code&gt;data-index&lt;/code&gt; attribute with the &lt;code&gt;index&lt;/code&gt; property of the item object in our list) then store and display the new list&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ip5GvXSE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wn0cij715gwjugjxu70.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ip5GvXSE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wn0cij715gwjugjxu70.png" alt="Code for hiding and unhiding the delete button" width="880" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G6uK51sw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1mpl7koj4ekgvxgegy2x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G6uK51sw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1mpl7koj4ekgvxgegy2x.png" alt="Code for focus events" width="880" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QMICJi5i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9cvdwloafxa5a6bp8q8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QMICJi5i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9cvdwloafxa5a6bp8q8i.png" alt="Code for deleting item from the To Do List" width="880" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nPCVUcGa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5rp0azdfdgwnkw39lqx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nPCVUcGa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5rp0azdfdgwnkw39lqx.png" alt="Code for attaching click event listener to the remove button" width="880" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The edit mode was working as expected. As you can see the styles get applied and the button gets displayed when I go to the edit mode. And vice versa when I go out of focus of the input (click anywhere else in the document) the list items go to the initial state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DfBo_EtV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4fdgt7u0ayp9f2iyg70.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DfBo_EtV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4fdgt7u0ayp9f2iyg70.png" alt="To do list item in the edit mode" width="880" height="594"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Now this is where the problem takes place
&lt;/h3&gt;

&lt;p&gt;As I said before we are setting our delete button to &lt;code&gt;display: none&lt;/code&gt; on &lt;code&gt;focusout&lt;/code&gt; which removes it from the DOM. When we try to click on that button the &lt;code&gt;focusout&lt;/code&gt; event will fire and remove the element leaving us no chance of clicking on it and therefore deleting the list item. So how do we go around this bug?&lt;/p&gt;

&lt;p&gt;After a lot of researching and testing, I figured out that I need to find a way to skip the step of hiding the remove button when it gets clicked.&lt;/p&gt;

&lt;p&gt;If it was a click event we know that we could use &lt;strong&gt;&lt;em&gt;ClickEvent.target&lt;/em&gt;&lt;/strong&gt; to get the element that we click on. &lt;code&gt;Focusout&lt;/code&gt; event is different though. It does not listen to clicks but it gets triggered whenever we go out of focus of the element the event is attached to.&lt;/p&gt;

&lt;p&gt;Logging the event property I noticed the &lt;code&gt;relatedTarget&lt;/code&gt; key and its value being the element that we click on.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B3sSAbke--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kxrf3hdo28xo7yb0at0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B3sSAbke--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kxrf3hdo28xo7yb0at0.png" alt="Console output for the event" width="880" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we click on a blank space on the document we get &lt;code&gt;null&lt;/code&gt; as a value, but if it's an element the value is the element that we click on.&lt;/p&gt;

&lt;p&gt;From here we add our check to see if the clicked item contains the "btn-delete" class and we do nothing if it does(&lt;code&gt;return&lt;/code&gt;), otherwise we just hide the button. Here's what our event listener would look like in the end.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EXbcxIkN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2b4q2kewwdgc2tedt3tw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EXbcxIkN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2b4q2kewwdgc2tedt3tw.png" alt="Screenshot of focusout event code" width="880" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Viola! The bug has been fixed. Our to-do list app is now looking much better and cleaner and we can do whatever we want with it.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>css</category>
      <category>html</category>
    </item>
  </channel>
</rss>
