Poor INP caused by <a>

34 views
Skip to first unread message

juewei lin

unread,
Jun 24, 2024, 4:47:55 AM (5 days ago) Jun 24
to web-vitals-feedback
Hi!
I'm trying to solve our INP problem. With the help of web-vitals, I find that a large number of poor INP are coused by <a> tag with href. We do have a lot of <a> tags on our home page.
Supposedly, href should not trigger INP, what is going on here? And what can I do?

Barry Pollard

unread,
Jun 24, 2024, 4:53:39 AM (5 days ago) Jun 24
to web-vitals-feedback
In general, plain old <a> elements do not tend to cause INP issues, but there are a few reasons why they might:
  • Are there any event handlers attached to the <a> tags? For example, analytics to log external links that cause a lot of processing?
  • Is there a beforeunload handler which popups up a "Please don't leave!" message that takes a lot of processing.
  • Is this an SPA so the <a> elements are overridden and replaced with a so-called "soft navigation" handled by the JavaScript app and that takes time.
  • Is the main thread just really, really busy so clicking on an <a> element doesn't register the click until much, much later anyway.
Can you repeat slow INP in a DevTools trace? Or using the Web Vitals extension? With 6x (or even 20x) slowdown if necessary?

Is it particular links causing this? Are they internal/external?

As you can tell without any detail it's difficult to diagnose further...
Reply all
Reply to author
Forward
0 new messages