<?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>Forem: Abdul Rehman</title>
    <description>The latest articles on Forem by Abdul Rehman (@abdul___rehman).</description>
    <link>https://forem.com/abdul___rehman</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%2F3880170%2Fe9efbb44-a792-44aa-89b9-bde4d7f73137.png</url>
      <title>Forem: Abdul Rehman</title>
      <link>https://forem.com/abdul___rehman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/abdul___rehman"/>
    <language>en</language>
    <item>
      <title>They Blamed My Plugin. Here's How I Proved Them Wrong.</title>
      <dc:creator>Abdul Rehman</dc:creator>
      <pubDate>Wed, 15 Apr 2026 09:38:41 +0000</pubDate>
      <link>https://forem.com/abdul___rehman/they-blamed-my-plugin-heres-how-i-proved-them-wrong-3gk0</link>
      <guid>https://forem.com/abdul___rehman/they-blamed-my-plugin-heres-how-i-proved-them-wrong-3gk0</guid>
      <description>&lt;p&gt;It started with a message from a client.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Since your update, the site is slow and the buttons don't work unless you click them twice."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My gut said: &lt;em&gt;this isn't my code.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But gut feelings don't win client arguments. Evidence does.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Symptom
&lt;/h2&gt;

&lt;p&gt;Buttons on the site required &lt;strong&gt;two clicks&lt;/strong&gt; to fire. The site felt sluggish overall.&lt;/p&gt;

&lt;p&gt;To most people, that looks like a broken button. To me, that's a classic sign of a &lt;strong&gt;choked JavaScript main thread&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here's why:&lt;/p&gt;

&lt;p&gt;When the main thread is blocked, click events don't get ignored — they get &lt;strong&gt;queued&lt;/strong&gt;. The first click registers, but the handler can't execute because the thread is busy. The moment the thread frees up, the queued event fires — which is why the &lt;em&gt;second&lt;/em&gt; click seems to "work."&lt;/p&gt;

&lt;p&gt;The button isn't broken. The thread is.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Diagnosis
&lt;/h2&gt;

&lt;p&gt;Something on their site was blocking the main thread and preventing normal JavaScript execution. Common culprits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A heavy third-party script loading synchronously&lt;/li&gt;
&lt;li&gt;A poorly written plugin running expensive operations on the main thread&lt;/li&gt;
&lt;li&gt;A theme or script with a long task blocking the event loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key word: &lt;strong&gt;their site.&lt;/strong&gt; Not my plugin.&lt;/p&gt;




&lt;h2&gt;
  
  
  How I Proved It
&lt;/h2&gt;

&lt;p&gt;Rather than going back and forth in chat, I did this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deployed my plugin in a completely isolated environment&lt;/strong&gt; — fresh WordPress install, no other plugins, no custom theme, nothing else active&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recorded videos testing it on three devices&lt;/strong&gt; — my laptop, an Android phone, and an iPhone&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sent the standalone URL&lt;/strong&gt; so the client could test it themselves in real time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Result? Every button worked on the first click. Every time. On every device.&lt;/p&gt;

&lt;p&gt;The plugin wasn't the problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Lesson
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Isolate before you blame.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When a client reports a bug, resist the urge to defend your code with words. Instead, strip the environment down to one variable — your code, nothing else — and let the result speak.&lt;/p&gt;

&lt;p&gt;If it works in isolation, the problem is in the integration, not your implementation.&lt;/p&gt;

&lt;p&gt;This is especially true in WordPress, where plugin conflicts and main thread congestion from third-party scripts are incredibly common. A site running 20+ plugins and a bloated theme is a minefield. Your plugin might be the last one loaded, which makes it the easiest to blame — but rarely the actual culprit.&lt;/p&gt;




&lt;h2&gt;
  
  
  What to Look For
&lt;/h2&gt;

&lt;p&gt;If you're debugging a similar issue, open &lt;strong&gt;Chrome DevTools → Performance tab&lt;/strong&gt; and record a few seconds of interaction. Look for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Long Tasks&lt;/strong&gt; (red bars) blocking the main thread&lt;/li&gt;
&lt;li&gt;Scripts with high &lt;strong&gt;Total Blocking Time (TBT)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Synchronous third-party scripts in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools like &lt;strong&gt;WebPageTest&lt;/strong&gt; or &lt;strong&gt;Lighthouse&lt;/strong&gt; will also flag main thread congestion clearly.&lt;/p&gt;

&lt;p&gt;Once you identify the blocking script, the fix is usually one of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deferring or async-loading the script&lt;/li&gt;
&lt;li&gt;Removing the offending plugin&lt;/li&gt;
&lt;li&gt;Lazy-loading heavy third-party resources&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;The double-click symptom is almost never about the button. It's about what's happening around it.&lt;/p&gt;

&lt;p&gt;When something breaks after your change, don't just defend — &lt;strong&gt;demonstrate&lt;/strong&gt;. Build the isolated environment, record it, share it. Evidence is the only language that ends the argument.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you've run into something similar or have a different approach to diagnosing main thread issues — drop it in the comments. Always curious how others handle this.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
