{"id":531,"date":"2025-10-15T05:44:26","date_gmt":"2025-10-15T12:44:26","guid":{"rendered":"https:\/\/blog.mozilla.org\/performance\/?p=531"},"modified":"2025-10-15T05:44:26","modified_gmt":"2025-10-15T12:44:26","slug":"firefox-144-ships-interactionid-for-inp","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/performance\/2025\/10\/15\/firefox-144-ships-interactionid-for-inp\/","title":{"rendered":"Firefox 144 ships interactionId for INP"},"content":{"rendered":"<hr \/>\n<h2>TL;DR<\/h2>\n<p><b>Firefox 144<\/b> ships <code>PerformanceEventTiming.interactionId<\/code>, which lets browsers and tools group events that belong to the same user interaction. This property is used to calculate <b>Interaction to Next Paint (INP)<\/b>, one of the <a href=\"https:\/\/web.dev\/articles\/inp\">Core Web Vitals<\/a>.<\/p>\n<hr \/>\n<p><b>Firefox 144<\/b> ships support for the <code>PerformanceEventTiming.interactionId<\/code> property. It helps browsers and tools identify which input events belong to a single user interaction, such as a <code>pointerdown<\/code>, <code>pointerup<\/code>, and <code>click<\/code> triggered by the same tap.<\/p>\n<p>The <b>Interaction to Next Paint (INP)<\/b> metric, part of the <a href=\"https:\/\/web.dev\/articles\/inp\">Core Web Vitals<\/a>, relies on this grouping to measure how responsive a page feels during real user interactions. INP represents how long it takes for the next frame to paint after a user input. Instead of looking at a single event, it captures the worst interaction latency during the page\u2019s lifetime, giving a more complete view of responsiveness.<\/p>\n<h2>Why this matters<\/h2>\n<p>Before <code>interactionId<\/code>, each event had to be measured separately, which made it hard to connect related events as part of the same interaction.<br \/>\nWith this property, performance tools and developers can now:<\/p>\n<ul>\n<li aria-level=\"1\">Group related input events into a single interaction<\/li>\n<li aria-level=\"1\">Measure interaction latency more accurately<\/li>\n<li aria-level=\"1\">Identify and debug slow interactions more easily<\/li>\n<\/ul>\n<h2>Using interactionId<\/h2>\n<p>If you use the<a href=\"https:\/\/developer.mozilla.org\/docs\/Web\/API\/PerformanceObserver\"> PerformanceObserver API<\/a> to collect <code>PerformanceEventTiming<\/code> entries, you\u2019ll start seeing an <code>interactionId<\/code> field in Firefox 144. Events that share a non-zero <code>interactionId<\/code> belong to the same interaction group, which can be used to calculate latency or understand where delays occur.<\/p>\n<pre style=\"background: #2d2d2d; color: #ccc; padding: 10px; border-radius: 6px; overflow: auto; margin-top: 0; line-height: 1.4;\"><code><span style=\"color: #999;\">\/\/ The key is the interaction ID.<\/span>\r\n<span style=\"color: #cc99cd;\">let<\/span> <span style=\"color: #f99157;\">eventLatencies<\/span> = {};\r\n\r\n<span style=\"color: #cc99cd;\">const<\/span> <span style=\"color: #f99157;\">observer<\/span> = <span style=\"color: #6699cc;\">new<\/span> <span style=\"color: #6699cc;\">PerformanceObserver<\/span>((<span style=\"color: #f99157;\">list<\/span>) =&gt; {\r\n  list.<span style=\"color: #f2777a;\">getEntries<\/span>().<span style=\"color: #f2777a;\">forEach<\/span>((<span style=\"color: #f99157;\">entry<\/span>) =&gt; {\r\n    <span style=\"color: #cc99cd;\">if<\/span> (entry.<span style=\"color: #f99157;\">interactionId<\/span> &gt; 0) {\r\n      <span style=\"color: #cc99cd;\">const<\/span> <span style=\"color: #f99157;\">interactionId<\/span> = entry.<span style=\"color: #f99157;\">interactionId<\/span>;\r\n      <span style=\"color: #cc99cd;\">if<\/span> (!eventLatencies[interactionId]) {\r\n        eventLatencies[interactionId] = [];\r\n      }\r\n      eventLatencies[interactionId].<span style=\"color: #f2777a;\">push<\/span>(entry.<span style=\"color: #f99157;\">duration<\/span>);\r\n    }\r\n  });\r\n});\r\n\r\nobserver.<span style=\"color: #f2777a;\">observe<\/span>({ <span style=\"color: #f99157;\">type<\/span>: <span style=\"color: #99cc99;\">\"event\"<\/span>, <span style=\"color: #f99157;\">buffered<\/span>: <span style=\"color: #cc99cd;\">true<\/span> });\r\n\r\n<span style=\"color: #999;\">\/\/ Log events with maximum event duration for a user interaction<\/span>\r\n<span style=\"color: #6699cc;\">Object<\/span>.<span style=\"color: #f2777a;\">entries<\/span>(eventLatencies).<span style=\"color: #f2777a;\">forEach<\/span>(([<span style=\"color: #f99157;\">k<\/span>, <span style=\"color: #f99157;\">v<\/span>]) =&gt; {\r\n  <span style=\"color: #6699cc;\">console<\/span>.<span style=\"color: #f2777a;\">log<\/span>(<span style=\"color: #6699cc;\">Math<\/span>.<span style=\"color: #f2777a;\">max<\/span>(...v));\r\n});\r\n<\/code><\/pre>\n<p>If you use external tools and libraries like <a href=\"https:\/\/github.com\/GoogleChrome\/web-vitals\">web-vitals<\/a>, they should already collect the INP value for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR Firefox 144 ships PerformanceEventTiming.interactionId, which lets browsers and tools group events that belong to the same user interaction. This property is used to calculate Interaction to Next Paint (INP), &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/performance\/2025\/10\/15\/firefox-144-ships-interactionid-for-inp\/\">Read more<\/a><\/p>\n","protected":false},"author":1859,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[457019],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts\/531"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/users\/1859"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/comments?post=531"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/posts\/531\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/media?parent=531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/categories?post=531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/performance\/wp-json\/wp\/v2\/tags?post=531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}