<?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: Srikar Phani Kumar Marti</title>
    <description>The latest articles on DEV Community by Srikar Phani Kumar Marti (@mspk97).</description>
    <link>https://dev.to/mspk97</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2519231%2F04ef8b8c-91fd-4ba1-a9b7-1e98f84baf6a.png</url>
      <title>DEV Community: Srikar Phani Kumar Marti</title>
      <link>https://dev.to/mspk97</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mspk97"/>
    <language>en</language>
    <item>
      <title>How AI-Powered UI Components Manage Real-Time User Edits Without State Conflicts</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Fri, 04 Dec 2026 15:17:42 +0000</pubDate>
      <link>https://dev.to/mspk97/how-ai-powered-ui-components-manage-real-time-user-edits-without-state-conflicts-27kc</link>
      <guid>https://dev.to/mspk97/how-ai-powered-ui-components-manage-real-time-user-edits-without-state-conflicts-27kc</guid>
      <description>&lt;p&gt;You’re typing away in an AI-powered text editor or form, and suddenly the AI’s suggestion overwrites the word you just fixed. Or worse, you fix a typo, but after a second, it’s back again ,  like your correction never happened. Frustrating, right?&lt;/p&gt;

&lt;p&gt;I hit this exact annoyance building an interface where AI suggestions stream in live as the user edits. The core challenge? The AI and the user are both trying to update the same piece of UI state at the same time. Without careful handling, their changes collide, causing a buggy mess.&lt;/p&gt;

&lt;p&gt;Let’s unpack how these components manage to merge the user’s real-time edits with AI-generated suggestions without stepping on each other’s toes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Tug-of-War Between User and AI Updates
&lt;/h2&gt;

&lt;p&gt;Imagine the state of a text input as a single source of truth. Both the user’s keyboard events and the AI’s suggestion updates try to write to it. The user might be in the middle of typing or correcting, while the AI streams in new completions or refinements asynchronously.&lt;/p&gt;

&lt;p&gt;If the UI just blindly applies AI updates as they arrive, it can easily overwrite the user’s ongoing edits. Conversely, if it always prioritizes the user’s input and ignores AI updates, the AI becomes useless.&lt;/p&gt;

&lt;p&gt;The result is a classic race condition on UI state:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user changes the input locally.&lt;/li&gt;
&lt;li&gt;The AI sends a suggestion based on stale input.&lt;/li&gt;
&lt;li&gt;The UI updates to AI’s stale suggestion, overwriting the user’s new edit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You might see flickering, lost characters, or confusing reverts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the State Model: Separate Tracks for User and AI
&lt;/h2&gt;

&lt;p&gt;The first insight is to track &lt;strong&gt;two separate versions&lt;/strong&gt; of the input:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Local User State:&lt;/strong&gt; The raw input as the user types and edits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI Suggestion State:&lt;/strong&gt; The latest suggestion or completion from the AI backend.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both exist simultaneously. The UI must decide how to combine them for display without losing either’s intent.&lt;/p&gt;

&lt;p&gt;Consider an example: You typed "helol", and the AI suggests "hello". You spot the typo and correct the "o" to "l" manually. But the AI suggestion is still arriving based on your previous input.&lt;/p&gt;

&lt;p&gt;If the UI replaces your correction immediately with the AI’s stale "hello", you lose your fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Timestamping and Versioning: Who’s Latest, Really?
&lt;/h2&gt;

&lt;p&gt;One practical mechanism is to tag every AI suggestion with a &lt;strong&gt;version or timestamp&lt;/strong&gt; that corresponds to the user input it was generated from.&lt;/p&gt;

&lt;p&gt;The UI keeps track of the latest user input version seen. When an AI suggestion arrives, it checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does this AI suggestion correspond to the latest user input version?&lt;/li&gt;
&lt;li&gt;If yes, it’s safe and fresh ,  update the UI.&lt;/li&gt;
&lt;li&gt;If not, discard or delay applying it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This simple version check prevents stale AI suggestions from overwriting newer user edits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Merging Strategies: Showing Suggestions Without Erasing Edits
&lt;/h2&gt;

&lt;p&gt;Sometimes the AI suggestions aren’t full replacements but partial completions or inline hints.&lt;/p&gt;

&lt;p&gt;A common pattern is to store the user’s input as the &lt;strong&gt;base text&lt;/strong&gt;, and overlay the AI suggestion as a &lt;strong&gt;highlighted ghost text&lt;/strong&gt; appended or injected.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User types: "hel"&lt;/li&gt;
&lt;li&gt;AI suggests: "hello"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The UI shows "hel" as normal text, and "lo" as faint ghost text.&lt;/p&gt;

&lt;p&gt;When the user keeps typing, the ghost text updates or disappears, never erasing the user’s keystrokes.&lt;/p&gt;

&lt;p&gt;This requires the UI to maintain independent buffers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One for user input&lt;/li&gt;
&lt;li&gt;One for AI completions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And a rendering logic that merges them visually without destructive updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling Concurrent Updates: Locking vs Optimistic Updates
&lt;/h2&gt;

&lt;p&gt;Under the hood, implementations often choose between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Locking:&lt;/strong&gt; Temporarily block AI updates while the user is typing or editing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimistic merging:&lt;/strong&gt; Apply AI updates only if they don’t conflict with recent user changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Locking is simpler but can delay helpful AI suggestions, making the UI feel sluggish.&lt;/p&gt;

&lt;p&gt;Optimistic merging is more complex but smoother ,  it requires fine-grained diffing and conflict detection.&lt;/p&gt;

&lt;p&gt;For example, some editors detect if the user’s cursor is inside the text range the AI wants to replace. If yes, they postpone AI updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debouncing and Delaying AI Updates
&lt;/h2&gt;

&lt;p&gt;Since AI suggestions come asynchronously and often slowly compared to typing speed, debouncing AI updates helps.&lt;/p&gt;

&lt;p&gt;The UI waits for a short pause in user typing (say 300ms) before applying AI suggestions. This avoids overwriting rapid typing bursts.&lt;/p&gt;

&lt;p&gt;Similarly, if the user is actively editing, the UI can delay applying AI completions until the input stabilizes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-Life Debugging Anecdote
&lt;/h2&gt;

&lt;p&gt;I once saw a bug where corrections to an AI-suggested label vanished repeatedly. Turns out the AI suggestions streamed in multiple partial updates without version tags.&lt;/p&gt;

&lt;p&gt;The UI blindly applied each partial update, erasing the user’s fixes.&lt;/p&gt;

&lt;p&gt;Fixing it involved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding versioning to each AI chunk&lt;/li&gt;
&lt;li&gt;Buffering and applying only the latest AI suggestion matching the user input version&lt;/li&gt;
&lt;li&gt;Visualizing the user input separately from AI suggestions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That greatly improved UX and prevented lost edits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summing It Up
&lt;/h2&gt;

&lt;p&gt;Managing real-time user edits alongside AI-generated suggestions is a subtle dance.&lt;/p&gt;

&lt;p&gt;You need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Track user edits and AI suggestions as separate but related states&lt;/li&gt;
&lt;li&gt;Use versioning or timestamps to avoid applying stale AI updates&lt;/li&gt;
&lt;li&gt;Merge user input and AI suggestions visually without destructive overwrites&lt;/li&gt;
&lt;li&gt;Apply debouncing and conflict detection to keep the UI responsive and predictable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’ve felt the frustration of your typing being overwritten by an AI, now you know there’s a lot of careful state juggling under the hood to keep that from happening.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.dev/" rel="noopener noreferrer"&gt;web.dev performance guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://platform.openai.com/docs" rel="noopener noreferrer"&gt;OpenAI developer resources&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/how-ai-powered-ui-components-manage-real-time-user-edits-without-state-conflicts" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>debugging</category>
    </item>
    <item>
      <title>Latency vs. Security Tradeoffs in AI-Driven FinTech Workflows: An Under-the-Hood Analysis</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Thu, 03 Dec 2026 14:31:18 +0000</pubDate>
      <link>https://dev.to/mspk97/latency-vs-security-tradeoffs-in-ai-driven-fintech-workflows-an-under-the-hood-analysis-5glh</link>
      <guid>https://dev.to/mspk97/latency-vs-security-tradeoffs-in-ai-driven-fintech-workflows-an-under-the-hood-analysis-5glh</guid>
      <description>&lt;p&gt;You’ve just rolled out an AI-powered fraud detection model in your FinTech app, expecting lightning-fast decisioning. Yet users complain about sluggish transaction approvals or delayed risk alerts. You dig into logs, and sure enough, the model predicts in milliseconds, but the overall workflow drags.&lt;/p&gt;

&lt;p&gt;What’s going on?&lt;/p&gt;

&lt;p&gt;Turns out, in FinTech, AI isn’t just about raw model speed. Under the hood, there’s a complex dance balancing latency, security, and compliance ,  especially around data encryption, multi-party computation, and audit trails. These steps add overhead but are essential to protect sensitive financial data.&lt;/p&gt;

&lt;p&gt;Let me walk you through what really happens inside these AI workflows, the tradeoffs they make, and how you can spot and debug the bottlenecks.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Familiar Trap: Fast AI, Slow Pipeline
&lt;/h2&gt;

&lt;p&gt;You start by profiling your AI service. The model inference takes a few milliseconds, perfect. But the full pipeline, including data prep, encryption, secure computation, and recording audit logs, adds hundreds of milliseconds, sometimes seconds.&lt;/p&gt;

&lt;p&gt;Your first instinct might be to blame the AI or the network. But that’s only part of the story.&lt;/p&gt;

&lt;p&gt;For example, when a transaction request arrives, it’s often encrypted end-to-end before reaching your AI system. This means your pipeline must decrypt or process encrypted data securely before inference. Then, after prediction, the result might be combined with sensitive data held by other parties via secure multi-party computation (MPC). Finally, you need to write tamper-proof audit logs for regulators.&lt;/p&gt;

&lt;p&gt;Each of these steps adds latency, but skipping them would expose you to data breaches or regulatory fines.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Encryption Slows You Down ,  And Why It Must
&lt;/h2&gt;

&lt;p&gt;Encrypting data isn’t just about slapping on HTTPS or TLS. FinTech workflows often require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data-at-rest encryption:&lt;/strong&gt; Sensitive info stored encrypted on disk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data-in-use encryption:&lt;/strong&gt; Techniques like Homomorphic Encryption or MPC that allow computations on encrypted data without exposing raw values.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key management:&lt;/strong&gt; Securely handling cryptographic keys, sometimes with hardware security modules (HSMs).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Take MPC, for example. Instead of handing raw data to a single AI service, multiple parties hold encrypted shares. They perform joint computations where the AI inference runs on combined encrypted inputs without revealing them individually.&lt;/p&gt;

&lt;p&gt;This is powerful for privacy but costly. Each MPC operation involves rounds of communication, cryptographic operations, and coordination that can multiply your latency by 10x or more compared to plaintext inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Audit Trails: The Silent Latency Culprit
&lt;/h2&gt;

&lt;p&gt;FinTech companies must keep detailed, immutable audit logs showing every data access, model decision, and user action. These logs ensure compliance with regulations like GDPR, PCI-DSS, or SOX.&lt;/p&gt;

&lt;p&gt;But writing these logs isn’t as simple as appending to a file. Often, they are stored in append-only ledgers, or blockchain-style systems, or sent to secure SIEMs with encryption and tamper detection.&lt;/p&gt;

&lt;p&gt;Each audit event might wait for confirmation from external systems or consensus protocols, introducing latency spikes. Plus, logs sometimes trigger synchronous workflows ,  for example, alerting a security team ,  that stall transaction flows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Latency Bottlenecks: Practical Tips
&lt;/h2&gt;

&lt;p&gt;If your AI workflow feels slow, here’s how to dig in:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Trace the full request lifecycle
&lt;/h2&gt;

&lt;p&gt;Log timestamps at each stage: data receipt, decryption start/end, MPC rounds, model inference, audit logging, final response.&lt;/p&gt;

&lt;p&gt;You might find MPC steps or audit writes dominate latency, not your AI.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Profile cryptographic operations
&lt;/h2&gt;

&lt;p&gt;Use profiling tools or instrument crypto libraries to measure CPU and memory usage during encryption and MPC. Heavy CPU spikes mean hardware acceleration or better algorithms might help.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Monitor network chatter
&lt;/h2&gt;

&lt;p&gt;MPC involves multiple parties communicating. Network latency or packet loss can kill performance. Check network health between MPC participants.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Audit log system responsiveness
&lt;/h2&gt;

&lt;p&gt;If audit logs rely on external systems, check their throughput and error rates. Sometimes retry storms or slow consensus cause unexpected delays.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Experiment with batching and async
&lt;/h2&gt;

&lt;p&gt;Batching requests or audit events helps amortize overhead. Also, consider making audit logging asynchronous where compliance allows, to avoid blocking main flows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Balancing Security and Speed: What You Can Tune
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Choose the right cryptography:&lt;/strong&gt; Not all MPC or homomorphic encryption schemes are equal. Some prioritize speed over maximal privacy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hardware acceleration:&lt;/strong&gt; Use CPUs with AES-NI, dedicated crypto chips, or GPUs to speed up encryption.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Parallelize MPC rounds:&lt;/strong&gt; Structure computations to minimize sequential steps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audit log design:&lt;/strong&gt; Use eventual consistency or hybrid approaches to reduce blocking.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hybrid data flows:&lt;/strong&gt; Sometimes, classify data by sensitivity and only encrypt the most critical parts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When Latency Really Matters: Real-world Tradeoffs
&lt;/h2&gt;

&lt;p&gt;In some cases, milliseconds matter, think high-frequency trading or real-time fraud blocking.&lt;/p&gt;

&lt;p&gt;Here, you might:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accept lower security guarantees for speed, e.g., encrypting data at rest but not in use.&lt;/li&gt;
&lt;li&gt;Use precomputed MPC shares offline.&lt;/li&gt;
&lt;li&gt;Cache AI predictions for known patterns.&lt;/li&gt;
&lt;li&gt;Use partial audit logs with deferred full recording.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are risky and require careful assessment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;The next time your AI-powered FinTech workflow feels slow despite a speedy model, remember: encryption, secure multi-party computation, and audit logging are often the hidden causes.&lt;/p&gt;

&lt;p&gt;They add necessary layers of protection and trust, but also complexity and latency.&lt;/p&gt;

&lt;p&gt;Understanding these layers helps you debug smarter and make informed tradeoffs between security and performance.&lt;/p&gt;

&lt;p&gt;That way, your AI can be both fast and safe, keeping your users’ money and data secure without frustrating delays.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.dev/" rel="noopener noreferrer"&gt;web.dev performance guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://platform.openai.com/docs" rel="noopener noreferrer"&gt;OpenAI developer resources&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/latency-vs-security-tradeoffs-in-ai-driven-fintech-workflows-an-under-the-hood-analysis" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>fintech</category>
      <category>performance</category>
    </item>
    <item>
      <title>Inside AI-Driven Visual Layout Reviewers: Parsing Component Trees and Style Rules</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Wed, 02 Dec 2026 11:47:30 +0000</pubDate>
      <link>https://dev.to/mspk97/inside-ai-driven-visual-layout-reviewers-parsing-component-trees-and-style-rules-je3</link>
      <guid>https://dev.to/mspk97/inside-ai-driven-visual-layout-reviewers-parsing-component-trees-and-style-rules-je3</guid>
      <description>&lt;p&gt;You’ve just run your AI-powered visual layout reviewer over a fresh UI build, expecting a clean bill of health. Instead, it flags weird spacing issues, overlapping buttons, or inconsistent margins ,  sometimes correctly, sometimes not. You squint at the report, wondering how the AI even understands your components and styles enough to call these out.&lt;/p&gt;

&lt;p&gt;I’ve been down that rabbit hole. The magic behind these AI reviewers isn’t just fancy image recognition or vague heuristics. It’s a systematic parse of your app’s component tree combined with a detailed analysis of CSS rules ,  all to build a precise model of the UI layout under the hood.&lt;/p&gt;

&lt;p&gt;Let’s unpack how these tools break down your UI structure and styles to detect layout inconsistencies, the tricky tradeoffs they make, and practical tips for debugging what the AI flags.&lt;/p&gt;

&lt;h2&gt;
  
  
  When AI Meets Component Trees: The First Step
&lt;/h2&gt;

&lt;p&gt;Your UI isn’t just pixels; it’s a hierarchy of components or elements, each with roles, sizes, positions, and styles. To reason about layout, AI reviewers first need to reconstruct this tree.&lt;/p&gt;

&lt;p&gt;Depending on the tool, this might come from React or Vue component metadata, a DOM snapshot, or a hybrid approach combining code analysis and runtime inspection. The goal is to represent the UI as a nested tree, where each node corresponds to a visual block ,  a button, container, image, or text block.&lt;/p&gt;

&lt;p&gt;This tree isn’t just for show. It captures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hierarchy:&lt;/strong&gt; Which elements contain which ,  crucial for detecting misplaced or orphaned components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic roles:&lt;/strong&gt; Whether a node is a button, header, or card, which influences layout expectations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Geometric info:&lt;/strong&gt; Bounding boxes, margins, paddings, and computed CSS styles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, imagine a card component containing a header, an image, and a button. The AI reviewer checks if the button’s margin is consistent with other cards, or if the image overlaps the header unexpectedly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parsing Styles: Beyond Just CSS Selectors
&lt;/h2&gt;

&lt;p&gt;Knowing which style rules apply to which components is more subtle than it sounds. CSS cascade, specificity, inheritance, media queries, and dynamic styles all affect the final layout.&lt;/p&gt;

&lt;p&gt;AI tools often tap into the browser’s computed styles at runtime to get the exact resolved values for each node. This avoids wrestling with raw CSS rules and cascade logic but requires capturing snapshots at the right time, typically after all stylesheets and scripts have loaded.&lt;/p&gt;

&lt;p&gt;But there’s a catch: computed styles are flat, so the AI has to reverse engineer which rules influenced a style, or at least cluster nodes by their effective styles to spot inconsistencies.&lt;/p&gt;

&lt;p&gt;Consider a scenario where two buttons look similar but differ because one has an override style from a CSS module or inline style. The AI reviewer flags this subtle difference as a potential inconsistency.&lt;/p&gt;

&lt;h2&gt;
  
  
  How AI Detects Layout Anomalies
&lt;/h2&gt;

&lt;p&gt;Once the AI has a tree with geometric and style info, it applies heuristics or learned models to find problems like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inconsistent spacing:&lt;/strong&gt; Margins or paddings that deviate from design system tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overlapping elements:&lt;/strong&gt; Bounding boxes intersecting where they shouldn’t.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unexpected hierarchy:&lt;/strong&gt; Components nested incorrectly, like inputs outside forms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Misaligned items:&lt;/strong&gt; Text or icons not properly centered or aligned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some tools train on large datasets of “correct” layouts, learning typical style distributions and spatial relationships. Others rely on rule-based checks tuned to your design system.&lt;/p&gt;

&lt;p&gt;For example, it might detect that all card footers have 16px bottom padding but this one has 8px, or that a modal’s close button sits outside the modal container.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Tradeoff: False Positives vs Missed Issues
&lt;/h2&gt;

&lt;p&gt;AI layout reviewers are powerful but not perfect. They often err on the side of caution, flagging borderline cases to avoid missing real bugs. This means developers sometimes see false positives ,  flagged issues that are actually intentional or harmless.&lt;/p&gt;

&lt;p&gt;Understanding why the AI flags something helps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is the spacing different because of a responsive breakpoint?&lt;/li&gt;
&lt;li&gt;Did a dynamic style override confuse the AI?&lt;/li&gt;
&lt;li&gt;Is the component tree snapshot outdated or missing context?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Balancing sensitivity involves tuning the heuristics or thresholds, or feeding the AI more context about the design system and layout rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging AI Flags: From Alert to Fix
&lt;/h2&gt;

&lt;p&gt;When your AI reviewer reports layout issues, start by inspecting the component tree it analyzed. Many tools provide a visual overlay or export showing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The exact node flagged&lt;/li&gt;
&lt;li&gt;Computed style values compared to expected&lt;/li&gt;
&lt;li&gt;Ancestor components and their styles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try reproducing the flagged issue manually, checking if the AI’s snapshot matches the live state. Sometimes, timing differences or dynamic UI states cause mismatches.&lt;/p&gt;

&lt;p&gt;If the problem is a false positive, consider adding annotations or rules to your AI tool to whitelist exceptions. If it’s a true bug, the detailed style info helps you pinpoint whether it’s a CSS specificity problem, missing margin, or hierarchy mishap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;AI-driven layout reviewers are more than just image comparison bots. They reconstruct your UI’s component tree and compute style maps to reason about layout like a human, but at scale and speed.&lt;/p&gt;

&lt;p&gt;This approach helps catch subtle bugs early but comes with tradeoffs in complexity and occasional false positives. Understanding how these tools parse your UI under the hood empowers you to trust their reports, debug effectively, and keep your layouts solid as your app evolves.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;React documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://platform.openai.com/docs" rel="noopener noreferrer"&gt;OpenAI developer resources&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/inside-ai-driven-visual-layout-reviewers-parsing-component-trees-and-style-rules" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>frontend</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>How Tokenization Shapes AI Model Input Pipelines: Tradeoffs and Debugging</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Tue, 01 Dec 2026 11:49:53 +0000</pubDate>
      <link>https://dev.to/mspk97/how-tokenization-shapes-ai-model-input-pipelines-tradeoffs-and-debugging-243m</link>
      <guid>https://dev.to/mspk97/how-tokenization-shapes-ai-model-input-pipelines-tradeoffs-and-debugging-243m</guid>
      <description>&lt;p&gt;You’re staring at your AI model’s output and something feels off. Maybe it’s hallucinating nonsense, or ignoring parts of your prompt, or producing weirdly chopped text. You double-check your input string, but it looks fine ,  so what gives?&lt;/p&gt;

&lt;p&gt;Chances are, the culprit lies in the tokenization step ,  the often invisible first gatekeeper that converts raw text into tokens the model understands. I ran into this when fine-tuning a language model; debugging tokenization glitches turned out to be crucial for getting the behavior right.&lt;/p&gt;

&lt;p&gt;Let me show you how tokenization works under the hood, why it’s more than just splitting on spaces, and how tiny quirks here ripple down to affect your model’s outputs, sometimes subtly and other times catastrophically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tokenization Isn’t Just Splitting Words
&lt;/h2&gt;

&lt;p&gt;You might assume tokenization is simple ,  just break your prompt into words or characters. But modern large language models don’t operate on words; they use tokens that cover subword units, byte pairs, or byte-level chunks.&lt;/p&gt;

&lt;p&gt;One popular approach is &lt;strong&gt;Byte Pair Encoding (BPE)&lt;/strong&gt;, which starts from individual characters and iteratively merges frequent pairs to build a vocabulary of subwords. This lets the tokenizer represent common words as single tokens, but also handle rare or novel words by combining subword tokens.&lt;/p&gt;

&lt;p&gt;For example, the word "unhappiness" might tokenize into &lt;code&gt;["un", "hap", "pi", "ness"]&lt;/code&gt;. This is smarter than splitting by spaces but introduces complexity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The tokenizer’s vocabulary size and composition shape what chunks it recognizes.&lt;/li&gt;
&lt;li&gt;Some words split into many tokens, increasing input length and computation.&lt;/li&gt;
&lt;li&gt;Token boundaries might fall awkwardly, affecting model context.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Under the Hood: Vocabulary Lookup and Greedy Matching
&lt;/h2&gt;

&lt;p&gt;When you pass text to a tokenizer, it first encodes it into bytes (usually UTF-8). Then it greedily matches the longest possible tokens from its vocabulary starting at the beginning of the byte stream. It repeats this until the entire input is covered.&lt;/p&gt;

&lt;p&gt;Because it works at the byte level, even unusual Unicode characters get tokenized into bytes that the model can handle, avoiding out-of-vocabulary errors.&lt;/p&gt;

&lt;p&gt;Here’s a rough example:&lt;/p&gt;

&lt;p&gt;Input text: "hello!"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encoded to bytes: &lt;code&gt;[104, 101, 108, 108, 111, 33]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Tokenizer tries to match longest tokens starting at byte 0:

&lt;ul&gt;
&lt;li&gt;It might find "hello" as a single token.&lt;/li&gt;
&lt;li&gt;Then "!" as another token.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tokens are then mapped to integer IDs used as input to the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Tokenization Goes Wrong: Surprises to Watch For
&lt;/h2&gt;

&lt;p&gt;Tokenization errors or quirks can quietly sabotage your model’s results:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Invisible characters or whitespace:&lt;/strong&gt; Extra spaces, zero-width spaces, or unusual newline characters can lead to unexpected tokens, confusing the model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mismatched encodings:&lt;/strong&gt; Feeding input in the wrong encoding (e.g., UTF-16 instead of UTF-8) produces garbage tokens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Partial tokens from truncation:&lt;/strong&gt; Cutting input mid-token (common when limiting input length) can produce invalid tokens leading to garbage output or errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tokenizer and model vocab mismatch:&lt;/strong&gt; Using a tokenizer and model trained with different vocabularies leads to unpredictable results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Case sensitivity and normalization:&lt;/strong&gt; Some tokenizers lowercase inputs or normalize Unicode, which can change token sequences and thus model behavior.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Debugging Tokenization Issues: Practical Tips
&lt;/h2&gt;

&lt;p&gt;When your model’s output surprises you, start by inspecting the tokens:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Print tokens and their string forms:&lt;/strong&gt; Most tokenizers let you convert strings to tokens and back. Check if the tokenization matches your expectations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Look for unexpected tokens:&lt;/strong&gt; Unusual tokens like &lt;code&gt;[UNK]&lt;/code&gt; (unknown token) or unexpected special tokens might signal problems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check for invisible characters:&lt;/strong&gt; Print the input as a byte array or with escape sequences to spot hidden whitespace or control characters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Verify tokenizer and model alignment:&lt;/strong&gt; Confirm that you’re using the correct tokenizer version for your model checkpoint.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test edge cases:&lt;/strong&gt; Try inputs with emojis, accented letters, or non-English scripts to see how they tokenize.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use tokenizer debug tools:&lt;/strong&gt; Some libraries provide verbose tokenization logs or visualization.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Tradeoffs: Why Tokenization Is a Balancing Act
&lt;/h2&gt;

&lt;p&gt;Tokenization design balances competing factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Vocabulary size:&lt;/strong&gt; Larger vocabularies mean fewer tokens per input but bigger embedding tables and slower training.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Granularity:&lt;/strong&gt; Finer granularity (like character-level) handles all inputs but increases input length and model compute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Handling rare words:&lt;/strong&gt; Subword tokenization allows open vocabulary but can split words awkwardly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Speed vs accuracy:&lt;/strong&gt; Tokenizers must be fast and deterministic; complex tokenization hurts latency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cross-lingual support:&lt;/strong&gt; Tokenizers trained on multiple languages must handle diverse scripts, which complicates vocabulary design.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Concrete Example: Debugging a Tokenization Bug
&lt;/h2&gt;

&lt;p&gt;I once saw a model hallucinate a repeated phrase whenever the input contained an emoji. Turns out the tokenizer split the emoji into multiple tokens unexpectedly, increasing input length and confusing the model’s attention.&lt;/p&gt;

&lt;p&gt;By dumping the token IDs and their string forms, I noticed the emoji was represented as three tokens instead of one. Switching to a byte-level tokenizer fixed this by treating the emoji as a single token, taming the model’s output.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Tokenization might feel like a black box, but it shapes every word your AI model sees. Understanding how it works, spotting tokenization surprises, and carefully matching tokenizer to model can save you hours of head-scratching.&lt;/p&gt;

&lt;p&gt;Next time your AI output goes sideways, remember to check the tokens first. They often tell the real story.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://platform.openai.com/docs" rel="noopener noreferrer"&gt;OpenAI developer resources&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/how-tokenization-shapes-ai-model-input-pipelines-tradeoffs-and-debugging" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>aiengineering</category>
    </item>
    <item>
      <title>Multi-Agent AI Systems in Financial Fraud Detection: How They Coordinate and Keep Secrets</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Mon, 30 Nov 2026 11:46:28 +0000</pubDate>
      <link>https://dev.to/mspk97/multi-agent-ai-systems-in-financial-fraud-detection-how-they-coordinate-and-keep-secrets-1lbm</link>
      <guid>https://dev.to/mspk97/multi-agent-ai-systems-in-financial-fraud-detection-how-they-coordinate-and-keep-secrets-1lbm</guid>
      <description>&lt;p&gt;You know that sinking feeling when a suspicious transaction slips through your fraud detection system? Or worse, when your system flags too many false alarms and annoys real customers? When I first dug into multi-agent AI systems for fraud detection, I found out that the magic happens not from one supermodel but from a whole team of AI agents working together. But how do they coordinate without spilling sensitive data or slowing down real-time detection?&lt;/p&gt;

&lt;p&gt;Let me walk you through what’s really going on inside these multi-agent AI setups, how they collaborate securely, and the tradeoffs that shape their latency and accuracy.&lt;/p&gt;

&lt;h2&gt;
  
  
  When One AI Isn’t Enough: The Rise of Multi-Agent Systems
&lt;/h2&gt;

&lt;p&gt;Traditional fraud detection AI models try to do everything at once ,  analyzing transaction features, user behavior, device info, and more ,  in one big model. But financial fraud is a moving target. Different fraud types require different expertise, and data sits in silos due to privacy constraints.&lt;/p&gt;

&lt;p&gt;That’s where multiple specialized AI agents come in. Imagine each agent as a fraud detective with a specialty:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One agent analyzes transaction patterns.&lt;/li&gt;
&lt;li&gt;Another focuses on user behavior history.&lt;/li&gt;
&lt;li&gt;A third looks at device fingerprints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They each score the risk independently. Then they pool their insights to make a final decision.&lt;/p&gt;

&lt;p&gt;Sounds simple in theory, but coordinating these agents securely and efficiently is tricky.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing Insights Without Leaking Secrets
&lt;/h2&gt;

&lt;p&gt;Here’s the rub: these agents often have access to sensitive or regulated data they can’t share outright. Financial institutions have strict compliance rules. You can’t just dump raw data between agents.&lt;/p&gt;

&lt;p&gt;So how do agents collaborate?&lt;/p&gt;

&lt;h2&gt;
  
  
  Secure Multi-Party Computation (SMPC)
&lt;/h2&gt;

&lt;p&gt;One technique is SMPC, where agents compute joint functions on their private data without revealing it. For example, each agent encrypts its data, then they run cryptographic protocols to compute risk scores collectively.&lt;/p&gt;

&lt;p&gt;This sounds like sci-fi, but teams use it in practice to ensure no single agent sees another’s raw data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Federated Learning
&lt;/h2&gt;

&lt;p&gt;Another approach is federated learning. Each agent trains a local model on its data, then shares only model updates, not raw data, with a central aggregator. The aggregator combines these updates into a global model.&lt;/p&gt;

&lt;p&gt;This way, agents learn from each other’s experiences without sharing sensitive info.&lt;/p&gt;

&lt;h2&gt;
  
  
  Knowledge Distillation and Shared Representations
&lt;/h2&gt;

&lt;p&gt;Sometimes agents share abstracted insights ,  like risk embeddings or anomaly flags ,  instead of raw data. This is a balance between utility and privacy.&lt;/p&gt;

&lt;p&gt;For instance, an agent might only send a "suspiciousness score" or a vector representation that doesn’t allow reconstructing the original transaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping It Fast: Latency Challenges in Agent Coordination
&lt;/h2&gt;

&lt;p&gt;Fraud detection needs to happen in milliseconds to avoid blocking legitimate transactions or letting fraud through.&lt;/p&gt;

&lt;p&gt;But adding multiple agents and cryptographic protocols can add latency.&lt;/p&gt;

&lt;p&gt;How do systems speed this up?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parallel Processing:&lt;/strong&gt; Agents run their analysis concurrently rather than sequentially.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight Communication:&lt;/strong&gt; Instead of full data exchange, they send compressed scores or flags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Selective Invocation:&lt;/strong&gt; Not all agents run on every transaction. Some only activate on suspicious flags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge Deployment:&lt;/strong&gt; Agents closer to data sources reduce network delay.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real-World Example: Coordinated Fraud Scoring
&lt;/h2&gt;

&lt;p&gt;Let’s say a transaction comes in:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The transaction agent scores the amount and location mismatch.&lt;/li&gt;
&lt;li&gt;The user behavior agent checks recent login patterns.&lt;/li&gt;
&lt;li&gt;The device agent examines the device ID.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each sends a risk vector to an aggregator agent, which runs a final risk model. The aggregator only gets encrypted or abstracted vectors, not raw data.&lt;/p&gt;

&lt;p&gt;If the combined risk exceeds a threshold, the transaction is flagged.&lt;/p&gt;

&lt;p&gt;This architecture maintains data privacy and speeds up decision-making.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfalls and Gotchas
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Drift:&lt;/strong&gt; Agents trained separately can drift apart in their risk assessments if not regularly synchronized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Communication Overhead:&lt;/strong&gt; Overly chatty agents can flood the network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Risks:&lt;/strong&gt; Poorly designed protocols might leak info through side channels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex Debugging:&lt;/strong&gt; Tracing which agent caused a false positive can be a maze.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Architecture Matters
&lt;/h2&gt;

&lt;p&gt;Multi-agent AI systems let you tackle complex fraud patterns with specialized skills, respect data privacy, and maintain scalable, real-time detection.&lt;/p&gt;

&lt;p&gt;If you’re building or tuning fintech AI, understanding this inner teamwork and security dance helps you spot bottlenecks, design better agent interfaces, and balance privacy with accuracy.&lt;/p&gt;

&lt;p&gt;Next time your fraud system catches a sneaky case without slowing down customers, you can thank the invisible collaboration happening under the hood.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/" rel="noopener noreferrer"&gt;W3C WAI accessibility guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/w3schools-com" rel="noopener noreferrer"&gt;W3Schools accessibility tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://platform.openai.com/docs" rel="noopener noreferrer"&gt;OpenAI developer resources&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/multi-agent-ai-systems-in-financial-fraud-detection-how-they-coordinate-and-keep-secrets" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>machinelearning</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Secure AI Agents in FinTech: Architecting for Data Privacy and Compliance Without Killing AI’s Usefulness</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Fri, 27 Nov 2026 14:12:18 +0000</pubDate>
      <link>https://dev.to/mspk97/secure-ai-agents-in-fintech-architecting-for-data-privacy-and-compliance-without-killing-ais-4d1i</link>
      <guid>https://dev.to/mspk97/secure-ai-agents-in-fintech-architecting-for-data-privacy-and-compliance-without-killing-ais-4d1i</guid>
      <description>&lt;p&gt;You’ve just integrated an AI agent into your FinTech platform to handle customer queries or automate credit risk analysis. It’s running smoothly, until you realize you might be letting it see sensitive info it shouldn’t ,  or worse, you have no solid audit trail to prove compliance with data regulations. Getting the AI working was the easy part; locking down data privacy and compliance without breaking the AI’s usefulness? That’s the headache.&lt;/p&gt;

&lt;h2&gt;
  
  
  The FinTech AI Privacy Puzzle
&lt;/h2&gt;

&lt;p&gt;In FinTech, data is gold and liability. Regulations like GDPR, CCPA, PCI-DSS, and others impose strict rules on what data can be accessed, how it’s logged, and how long it’s retained. Your AI agent isn’t just any app component ,  it’s a complex service that needs to fetch, process, and sometimes generate insights from sensitive data.&lt;/p&gt;

&lt;p&gt;So how do you keep the AI from wandering off into data it shouldn’t touch, and how do you know it played by the rules?&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents as Gatekeepers: The Core Architectural Idea
&lt;/h2&gt;

&lt;p&gt;The trick I’ve found is to architect the AI as an agent running inside a layered security shell, not a free-roaming oracle.&lt;/p&gt;

&lt;p&gt;Instead of giving the AI direct database access or full data dumps, you build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Access Control Layers:&lt;/strong&gt; Code modules that expose only the minimal slices of data the AI needs for its task, filtered and sanitized.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Agent Middleware:&lt;/strong&gt; A service layer between AI and data sources that enforces access policies dynamically. Think of it as a gatekeeper checking permissions on every query.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audit Logging:&lt;/strong&gt; Every data request, response, and AI decision gets time-stamped and logged securely for compliance audits.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compliance Modules:&lt;/strong&gt; Automated checks that ensure data handling meets regulatory requirements, such as data masking, consent verification, and data retention policies.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Concrete Example: AI-Powered Loan Approval Agent
&lt;/h2&gt;

&lt;p&gt;Imagine an AI agent that helps underwriters by scoring loan applications. It needs access to customer credit history, income verification, and transaction records. But:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It must never see social security numbers or full account numbers.&lt;/li&gt;
&lt;li&gt;Every access to credit data must be logged.&lt;/li&gt;
&lt;li&gt;If a customer revokes consent, the agent must no longer see their data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How do you enforce this?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Access APIs:&lt;/strong&gt; You expose APIs that only return anonymized or tokenized customer identifiers, or masked financial details. The AI calls these APIs rather than databases directly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Policy Engine:&lt;/strong&gt; Before any API response, a policy engine checks if the AI’s current user context has the right permissions. If consent is revoked, the engine returns an error or empty data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Logging Middleware:&lt;/strong&gt; All API calls and responses get logged with metadata ,  who requested what, when, and why.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Agent Workflow Constraints:&lt;/strong&gt; You design the AI prompts and response parsers to never request or output forbidden data. For example, the prompt template excludes PII fields.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Under the Hood: Enforcing Access Controls Dynamically
&lt;/h2&gt;

&lt;p&gt;This setup demands tight integration between AI workflows and your data governance tools. Some mechanisms I’ve seen work well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Token Scoping:&lt;/strong&gt; AI agent tokens carry scoped permissions limiting what data they can query.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Context Propagation:&lt;/strong&gt; Downstream API calls inherit the user or session context so the policy engine can enforce consent and role-based access on the fly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Tagging:&lt;/strong&gt; Every data field or record is tagged with sensitivity labels. The middleware uses these tags to sanitize or redact data before sending it to AI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Transparent Proxying:&lt;/strong&gt; Instead of AI calling data sources directly, all queries flow through a proxy service that applies policies and logs activity.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Audit Logging: More Than Just a Record
&lt;/h2&gt;

&lt;p&gt;Logging every access isn’t just ticking a box. It’s about building trust with regulators and customers. Here are some lessons from my experience:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Logs must be &lt;strong&gt;immutable and tamper-evident&lt;/strong&gt; ,  consider append-only logs with cryptographic signatures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Include &lt;strong&gt;contextual data&lt;/strong&gt; like AI prompt inputs and outputs, not just raw data access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;strong&gt;centralized log aggregation&lt;/strong&gt; with role-based viewing so audits can be done efficiently without exposing sensitive logs to too many hands.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automate &lt;strong&gt;alerts&lt;/strong&gt; on suspicious access patterns or policy violations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Balancing Privacy With AI Effectiveness
&lt;/h2&gt;

&lt;p&gt;Locking down data access tightly can hobble AI if you’re not careful. You want the AI to still deliver value, so:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Design your &lt;strong&gt;data APIs to provide rich but sanitized abstraction layers&lt;/strong&gt;. For example, aggregate statistics instead of raw transactions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;strong&gt;differential privacy or synthetic data&lt;/strong&gt; where possible to augment training without exposing real data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implement &lt;strong&gt;fine-grained prompt engineering&lt;/strong&gt; to avoid the AI asking for or outputting forbidden data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test extensively with &lt;strong&gt;privacy risk modeling&lt;/strong&gt; to catch leakage before it hits production.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Building secure AI agents in FinTech isn’t about locking down your AI in a cage; it’s about designing a smart architecture with layered controls that let the AI do its job while respecting data privacy and compliance. By wrapping AI in gatekeeper middleware, enforcing dynamic access policies, and logging every move, you get both power and peace of mind.&lt;/p&gt;

&lt;p&gt;If you’re on this journey, think like a builder and a watchdog ,  craft your AI agents as careful data consumers, not wild card oracles. That’s what it takes to earn trust in FinTech’s high-stakes world.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://platform.openai.com/docs" rel="noopener noreferrer"&gt;OpenAI developer resources&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/secure-ai-agents-in-fintech-architecting-for-data-privacy-and-compliance-without-killing-ai-s-usefulness" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>architecture</category>
      <category>fintech</category>
    </item>
    <item>
      <title>Transformer Attention Mechanisms: What Happens Inside the Black Box</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Wed, 25 Nov 2026 11:48:53 +0000</pubDate>
      <link>https://dev.to/mspk97/transformer-attention-mechanisms-what-happens-inside-the-black-box-33df</link>
      <guid>https://dev.to/mspk97/transformer-attention-mechanisms-what-happens-inside-the-black-box-33df</guid>
      <description>&lt;p&gt;You’re staring at your Transformer model’s attention weights, trying to understand why it fixates on some tokens but ignores others. Maybe you’ve seen heatmaps with bright spots that don’t quite make sense, or your debugging tools show attention heads behaving wildly.&lt;/p&gt;

&lt;p&gt;I’ve been there too. Transformer attention often feels like a magical black box ,  the "secret sauce" that powers huge leaps in language understanding, but one that’s maddeningly opaque when you want to fix or interpret models.&lt;/p&gt;

&lt;p&gt;In this post, I’ll walk you through what actually happens inside that attention mechanism ,  not just the math formulas, but the step-by-step matrix dance that computes how each token looks at every other token. Understanding this will give you a clearer mental model for debugging misbehaving attention and interpreting results.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Moment You Meet Attention: Query, Key, and Value
&lt;/h2&gt;

&lt;p&gt;Transformers don’t just blindly process tokens; they dynamically weight how important each token is to every other token. That’s the job of the attention mechanism.&lt;/p&gt;

&lt;p&gt;At its core, attention is about matching &lt;strong&gt;queries&lt;/strong&gt; with &lt;strong&gt;keys&lt;/strong&gt; to get weights, then using those weights to combine &lt;strong&gt;values&lt;/strong&gt;. It’s like a search system inside the model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;query&lt;/strong&gt; is what you’re looking for.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;keys&lt;/strong&gt; are the items you’re searching through.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;values&lt;/strong&gt; are the info you actually want to retrieve.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every token in the input sequence has its own query, key, and value vectors, which are learned projections of the token’s embedding.&lt;/p&gt;

&lt;p&gt;If you’ve seen the formulas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Attention(Q, K, V) = softmax(QK^T / sqrt(d_k)) V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s just a compact way of saying:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compute dot products between each query and all keys.&lt;/li&gt;
&lt;li&gt;Scale by the square root of key dimension to keep numbers stable.&lt;/li&gt;
&lt;li&gt;Apply softmax to get normalized weights.&lt;/li&gt;
&lt;li&gt;Use these weights to take a weighted sum of the values.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But what does this look like in practice?&lt;/p&gt;

&lt;h2&gt;
  
  
  Walking Through the Matrix Operations
&lt;/h2&gt;

&lt;p&gt;Imagine your input sequence has length &lt;strong&gt;N&lt;/strong&gt; and each vector (query, key, value) has dimension &lt;strong&gt;d_k&lt;/strong&gt; or &lt;strong&gt;d_v&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You start with three matrices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Q: shape (N, d_k)&lt;/li&gt;
&lt;li&gt;K: shape (N, d_k)&lt;/li&gt;
&lt;li&gt;V: shape (N, d_v)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To get the relevance scores, you multiply Q by K transpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Q (N x d_k) times K^T (d_k x N) produces a (N x N) matrix.&lt;/li&gt;
&lt;li&gt;Each element [i, j] in this matrix is the dot product between the query vector of token i and the key vector of token j.&lt;/li&gt;
&lt;li&gt;This tells you how strongly token i attends to token j.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then you scale these scores by dividing by sqrt(d_k). This scaling prevents the dot products from growing too large and pushing the softmax into regions with very small gradients ,  stabilizing training.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, apply softmax row-wise to turn each row into a probability distribution. This means every token’s attention over all tokens sums to 1.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, multiply this attention weight matrix (N x N) by the value matrix V (N x d_v) to get the final attended representations. This blends the values from all tokens according to their attention weights.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Queries, Keys, and Values Are Learned Projections
&lt;/h2&gt;

&lt;p&gt;Instead of using the raw token embeddings directly, the model learns different linear projections to form Q, K, and V. This helps specialize the roles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;query projection&lt;/strong&gt; learns what to look for.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;key projection&lt;/strong&gt; learns what each token represents as a lookup key.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;value projection&lt;/strong&gt; captures the information to pass along.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These projections are just weight matrices trained end to end with the rest of the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Multi-Head Attention: Multiple Perspectives
&lt;/h2&gt;

&lt;p&gt;One neat trick is to run several attention mechanisms in parallel, called "heads." Each head has its own Q, K, V projections.&lt;/p&gt;

&lt;p&gt;Why? Each head can focus on different types of relationships. Maybe one head looks at syntax, another at named entities, and another at long-range dependencies.&lt;/p&gt;

&lt;p&gt;In practice, this means you have multiple sets of Q, K, V matrices, compute attention separately for each, then concatenate and project the outputs back into a single vector per token.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Means For Debugging and Interpretability
&lt;/h2&gt;

&lt;p&gt;Knowing these details helps when you’re trying to understand what attention heads are doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If an attention heatmap looks random, it might be because the learned Q/K projections haven’t specialized yet.&lt;/li&gt;
&lt;li&gt;Sharp peaks in attention weights mean the query is highly focused on specific keys.&lt;/li&gt;
&lt;li&gt;Uniform attention means the query isn’t discriminating well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also inspect Q, K, and V matrices directly during debugging to see how their distributions evolve during training or inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Gotchas and Surprises
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scaling before softmax is crucial.&lt;/strong&gt; Missing or changing the sqrt(d_k) factor can cause softmax to saturate and gradients to vanish.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Attention weights don’t sum to 1 across columns, only rows.&lt;/strong&gt; Each token’s attention over all tokens sums to 1, but columns sum can vary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Masked attention&lt;/strong&gt; (like in autoregressive models) sets some dot products to &lt;br&gt;
-infinity before softmax, effectively zeroing out attention to future tokens. This masking happens inside the dot product matrix before softmax.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Values shape matters.&lt;/strong&gt; The dimension of value vectors can differ from queries/keys. Sometimes it’s the same, sometimes not.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Attention is a weighted average, not a selection.&lt;/strong&gt; Even tokens with low attention weights contribute a little to the output.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrapping This Up
&lt;/h2&gt;

&lt;p&gt;Next time you stare at attention heatmaps or debug Transformer output, remember that behind the scenes, each token is computing a complex weighted average of all other tokens’ value vectors ,  guided by learned queries and keys, scaled and normalized through softmax.&lt;/p&gt;

&lt;p&gt;This matrix multiplication choreography is what lets Transformers flexibly attend to context, capture long-range dependencies, and power everything from language translation to code generation.&lt;/p&gt;

&lt;p&gt;Understanding these steps demystifies the "black box" and gives you tools to peek inside, interpret, and troubleshoot your models more confidently.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/" rel="noopener noreferrer"&gt;W3C WAI accessibility guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/w3schools-com" rel="noopener noreferrer"&gt;W3Schools accessibility tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/transformer-attention-mechanisms-what-happens-inside-the-black-box" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>debugging</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Mechanics of AI Interface Feedback Loops: Capturing User Corrections Without Breaking UX</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Mon, 23 Nov 2026 11:45:27 +0000</pubDate>
      <link>https://dev.to/mspk97/mechanics-of-ai-interface-feedback-loops-capturing-user-corrections-without-breaking-ux-4k2</link>
      <guid>https://dev.to/mspk97/mechanics-of-ai-interface-feedback-loops-capturing-user-corrections-without-breaking-ux-4k2</guid>
      <description>&lt;p&gt;You’ve just finished typing a prompt or tweaking an AI-generated suggestion, maybe correcting a label, adjusting a value, or rejecting a mistaken completion, and you expect the UI to instantly update, ready for your next move. But sometimes, the interface feels sluggish, or worse, your correction disappears, the AI’s response overwrites your input, and you think, “Why can’t this just behave like a normal app?”&lt;/p&gt;

&lt;p&gt;That frustration hit me recently while working on a project with live AI-assisted forms. The core challenge? Capturing user corrections and feedback in real time &lt;em&gt;without&lt;/em&gt; breaking the flow or introducing weird latency. Turns out, the mechanics of this feedback loop are subtle and surprisingly tricky.&lt;/p&gt;

&lt;p&gt;Let’s break down what’s really going on under the hood when AI interfaces try to capture your input, handle your corrections, and update the UI smoothly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Feedback Loop: More Than Just Input and Output
&lt;/h2&gt;

&lt;p&gt;At first glance, it seems straightforward: the user types or clicks, the AI responds, the UI updates. But that ignores a crucial reality, AI-generated content is often streaming in, partial, and probabilistic. Meanwhile, the user might be interacting with the UI, correcting or tweaking things mid-stream.&lt;/p&gt;

&lt;p&gt;For example, imagine an AI autocomplete suggesting a phrase as you type. You spot a typo and try to fix it while the suggestion is still arriving. If the UI just blindly replaces the input with the latest AI output, your correction is lost. That’s a broken experience.&lt;/p&gt;

&lt;p&gt;The key is managing two intertwined states:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;user’s local input and corrections&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;AI’s generated response as it streams or updates&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These have to coexist and merge carefully.&lt;/p&gt;

&lt;h2&gt;
  
  
  Event and State Management: Coordinating User Edits and AI Updates
&lt;/h2&gt;

&lt;p&gt;How do interfaces keep your input intact &lt;em&gt;while&lt;/em&gt; updating AI suggestions?&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Local State vs Remote AI State
&lt;/h2&gt;

&lt;p&gt;Typically, the UI maintains a local state reflecting your input and edits. Meanwhile, AI responses come asynchronously, often as partial streams. The interface needs to reconcile these two sources.&lt;/p&gt;

&lt;p&gt;A common pattern is to treat user edits as authoritative &lt;em&gt;until&lt;/em&gt; the AI finishes or the user signals completion. This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;While you’re typing or correcting, your local input state overrides incoming AI updates.&lt;/li&gt;
&lt;li&gt;The AI’s output is merged in only when it doesn’t conflict or after you pause.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This demands a nuanced event system that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detects user edits (input, selection, cursor position)&lt;/li&gt;
&lt;li&gt;Temporarily suspends AI state updates that would overwrite user changes&lt;/li&gt;
&lt;li&gt;Resumes syncing once the user stops typing&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Debouncing and Throttling AI Updates
&lt;/h2&gt;

&lt;p&gt;Since AI suggestions can stream rapidly, bombarding the UI with updates risks causing jitter or lost focus.&lt;/p&gt;

&lt;p&gt;Throttling or debouncing AI updates helps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Batch rapid AI output into manageable chunks&lt;/li&gt;
&lt;li&gt;Avoid interrupting user input with constant overwrites&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For instance, holding off AI state merges for 100-200ms after user input lets the user finish their edit before the AI response updates the UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Cursor and Selection Preservation
&lt;/h2&gt;

&lt;p&gt;One subtle but critical piece is preserving cursor position during updates.&lt;/p&gt;

&lt;p&gt;If the UI replaces text without maintaining cursor or selection, the user can lose their spot or type in the wrong place. This is especially tricky when AI updates insert or remove characters.&lt;/p&gt;

&lt;p&gt;Many implementations track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The cursor index before AI update&lt;/li&gt;
&lt;li&gt;The diff between old and new text&lt;/li&gt;
&lt;li&gt;Adjust cursor position accordingly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Failing to do this causes the cursor to jump unexpectedly, confusing users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design Tradeoffs: Balancing Latency, Responsiveness, and Clarity
&lt;/h2&gt;

&lt;p&gt;Even with careful state management, tradeoffs remain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Optimistic UI vs Consistency
&lt;/h2&gt;

&lt;p&gt;Should the UI show AI suggestions immediately, or wait until the AI response is stable?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Showing suggestions early feels responsive but risks flicker or overwriting user edits.&lt;/li&gt;
&lt;li&gt;Waiting for stable output reduces flicker but introduces latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A middle ground is incremental updates with clear UI cues (like loading spinners or subtle placeholders).&lt;/p&gt;

&lt;h2&gt;
  
  
  User Control: Letting Users Override AI
&lt;/h2&gt;

&lt;p&gt;Good AI UX lets users override or dismiss suggestions without frustration.&lt;/p&gt;

&lt;p&gt;Implementing undo, manual override, or explicit accept/reject actions helps prevent the AI from fighting the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedback Capture Without Interruptions
&lt;/h2&gt;

&lt;p&gt;If the AI UI aggressively resets input on every model update, users get annoyed.&lt;/p&gt;

&lt;p&gt;Instead, triggering AI updates only when the user pauses or via explicit action reduces interference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Example: Live Code Completion Editors
&lt;/h2&gt;

&lt;p&gt;I’ve seen these mechanics in action in live AI code editors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The editor buffers your keystrokes locally.&lt;/li&gt;
&lt;li&gt;AI completions stream in asynchronously.&lt;/li&gt;
&lt;li&gt;The UI merges completions only if they don’t conflict with your edits.&lt;/li&gt;
&lt;li&gt;Cursor position is preserved using diff algorithms.&lt;/li&gt;
&lt;li&gt;Updates are throttled to avoid UI jank.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This orchestration creates smooth interactions where the AI assists but never steals control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Building AI interfaces that capture user corrections without breaking UX requires juggling asynchronous AI streams, local user edits, and precise event coordination.&lt;/p&gt;

&lt;p&gt;It’s a dance of state management and event handling, preserving your intent while letting the AI help.&lt;/p&gt;

&lt;p&gt;Next time your AI UI feels smooth and responsive, you can thank the careful mechanics working quietly behind the scenes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/" rel="noopener noreferrer"&gt;W3C WAI accessibility guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/w3schools-com" rel="noopener noreferrer"&gt;W3Schools accessibility tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/mechanics-of-ai-interface-feedback-loops-capturing-user-corrections-without-breaking-ux" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aiux</category>
      <category>frontend</category>
      <category>ux</category>
      <category>performance</category>
    </item>
    <item>
      <title>How Time Slicing in Concurrent UI Architectures Improves Responsiveness</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Thu, 19 Nov 2026 12:40:22 +0000</pubDate>
      <link>https://dev.to/mspk97/how-time-slicing-in-concurrent-ui-architectures-improves-responsiveness-35j5</link>
      <guid>https://dev.to/mspk97/how-time-slicing-in-concurrent-ui-architectures-improves-responsiveness-35j5</guid>
      <description>&lt;p&gt;You know that moment when you scroll or type in your app and it feels sluggish? Maybe buttons don’t respond instantly, or parts of the UI flicker or partially update before settling. You wonder, “Why can’t this just stay smooth?”&lt;/p&gt;

&lt;p&gt;I’ve been there too. The culprit often hides deep in how your framework schedules work on the main thread. That’s where time slicing in concurrent UI architectures comes in ,  breaking heavy work into smaller chunks and yielding control to keep the UI responsive.&lt;/p&gt;

&lt;p&gt;Let me walk you through what time slicing really means under the hood, how schedulers decide when to pause work for user input, and some gotchas you might face when debugging partial renders or flickering UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Your UI Freezes: The Classic Blocking Problem
&lt;/h2&gt;

&lt;p&gt;Imagine you have a big update to render ,  say, a complex list or a chart with thousands of nodes. Traditionally, the browser runs JavaScript and rendering in a single thread. If your rendering task takes 100+ milliseconds straight, the browser can’t process any input events during that time.&lt;/p&gt;

&lt;p&gt;The result? The app feels frozen. Your clicks or typing lag because the main thread is busy.&lt;/p&gt;

&lt;p&gt;Previously, the browser had no way to interrupt or slice that work. It just had to finish before moving on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter Time Slicing: Breaking Work Into Manageable Chunks
&lt;/h2&gt;

&lt;p&gt;Modern frameworks like React (with Concurrent Mode), and some scheduler libraries, use time slicing to split big rendering tasks into smaller units of work, often called "fibers" or "units of work."&lt;/p&gt;

&lt;p&gt;Instead of doing all at once, the scheduler works on a chunk, then checks if there’s higher priority stuff ,  usually user input ,  to handle. If yes, it yields control back to the browser to process that input, then resumes later.&lt;/p&gt;

&lt;p&gt;This approach lets the UI stay interactive, even during large renders.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does the Scheduler Decide to Yield?
&lt;/h2&gt;

&lt;p&gt;Under the hood, the scheduler uses a deadline or timer to decide how long it can work before yielding. For example, it might work for 5ms, then check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Has user input or animation arrived?&lt;/li&gt;
&lt;li&gt;Is the frame budget for rendering almost up?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If yes, it pauses the rendering work.&lt;/p&gt;

&lt;p&gt;This is often implemented using APIs like &lt;code&gt;requestIdleCallback&lt;/code&gt; or a custom scheduler based on &lt;code&gt;MessageChannel&lt;/code&gt; or &lt;code&gt;postMessage&lt;/code&gt; to queue tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prioritizing Tasks
&lt;/h2&gt;

&lt;p&gt;Not all work is equal. Input events get higher priority than rendering. Network responses or logging might be lower priority.&lt;/p&gt;

&lt;p&gt;So the scheduler maintains a queue of tasks with priorities. It ensures that urgent work like processing a user’s keystroke runs before less urgent rendering continues.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Concrete Example: React’s Fiber Scheduler
&lt;/h2&gt;

&lt;p&gt;React’s Fiber architecture is probably the best-known example.&lt;/p&gt;

&lt;p&gt;When you update state, React splits rendering into units of work representing parts of the component tree. Each unit is small, like reconciling one component.&lt;/p&gt;

&lt;p&gt;React’s scheduler runs these units, then checks if it should yield based on time or pending input. If so, it stops and lets the browser handle input events, then continues later.&lt;/p&gt;

&lt;p&gt;This means your app stays responsive even during big renders.&lt;/p&gt;

&lt;h2&gt;
  
  
  But Why Do Partial Renders or Flickering Happen?
&lt;/h2&gt;

&lt;p&gt;Time slicing can introduce subtle bugs if not handled carefully.&lt;/p&gt;

&lt;h2&gt;
  
  
  Partial UI States
&lt;/h2&gt;

&lt;p&gt;Because rendering happens in chunks over multiple frames, you might see UI parts update before others. For example, a list might show half the new items, then the rest.&lt;/p&gt;

&lt;p&gt;If your components rely on side effects or have inconsistent intermediate states, this partial update can cause flickering or weird glitches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Suspense and Loading States
&lt;/h2&gt;

&lt;p&gt;Frameworks use Suspense boundaries to show fallback UI during async work. Time slicing can cause these boundaries to show and hide multiple times if the scheduler yields frequently.&lt;/p&gt;

&lt;p&gt;This can lead to flickering loaders or jumping content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stale Props or State
&lt;/h2&gt;

&lt;p&gt;If updates are interrupted and resumed later, you might run into cases where components see stale data during the intermediate phases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Time Slicing Issues
&lt;/h2&gt;

&lt;p&gt;When you spot flickering or partial renders, here’s what I recommend:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check your component’s side effects:&lt;/strong&gt; Are you performing DOM mutations or network calls during render? That’s a no-no. Render should be pure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use React DevTools Profiler:&lt;/strong&gt; It shows you how work is split across frames, helping you identify if time slicing causes multiple partial renders.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Beware of non-idempotent render logic:&lt;/strong&gt; Rendering should produce the same output multiple times safely. If it doesn’t, partial updates can break UI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test with and without concurrent mode:&lt;/strong&gt; Sometimes disabling concurrent features can isolate if time slicing is the cause.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Tune Time Slicing Behavior
&lt;/h2&gt;

&lt;p&gt;Schedulers often let you tweak parameters like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maximum work chunk size (how long to work before yielding)&lt;/li&gt;
&lt;li&gt;Priority levels for different tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adjusting these can balance responsiveness versus rendering speed.&lt;/p&gt;

&lt;p&gt;If you slice too aggressively, you get many small updates and possible flickers. If you slice too little, UI can freeze.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Time slicing in concurrent UI architectures helps keep your app responsive by breaking big work into small chunks and yielding to user input.&lt;/p&gt;

&lt;p&gt;This scheduling dance lets rendering and interaction coexist smoothly, but it also means your UI updates happen incrementally. That can cause partial renders or flickers if your components aren’t designed for it.&lt;/p&gt;

&lt;p&gt;Understanding how the scheduler works under the hood, prioritizes tasks, and chooses when to yield can help you debug these issues and tune your app’s responsiveness.&lt;/p&gt;

&lt;p&gt;Next time your UI feels sluggish or flickery, you’ll know to peek beneath the surface ,  it’s often the scheduler slicing time to keep your app feeling alive.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.dev/" rel="noopener noreferrer"&gt;web.dev performance guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;React documentation&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/how-time-slicing-in-concurrent-ui-architectures-improves-responsiveness" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>uiarchitecture</category>
      <category>frontend</category>
      <category>performance</category>
      <category>concurrentrendering</category>
    </item>
    <item>
      <title>State Normalization in Frontend Architecture: Mechanisms and Debugging of Flat vs Nested State Trees</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Wed, 18 Nov 2026 11:48:36 +0000</pubDate>
      <link>https://dev.to/mspk97/state-normalization-in-frontend-architecture-mechanisms-and-debugging-of-flat-vs-nested-state-trees-3cge</link>
      <guid>https://dev.to/mspk97/state-normalization-in-frontend-architecture-mechanisms-and-debugging-of-flat-vs-nested-state-trees-3cge</guid>
      <description>&lt;p&gt;You’ve just spent a frustrating hour chasing down a bug where your UI stubbornly refuses to update after changing some nested object in your app state. You’re sure you did everything right, immutable updates, correct hooks, batched dispatches, yet the component stays silent, like it’s frozen in time.&lt;/p&gt;

&lt;p&gt;I’ve been there. One of the biggest surprises in complex frontend apps is how the shape of your state, nested vs flat, can make or break update detection and debugging.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Nested State Trap: Why Deep Objects Can Break Change Detection
&lt;/h2&gt;

&lt;p&gt;Imagine you have a Redux or React state shaped like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Alice'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'NYC'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'10001'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'2'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Bob'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'LA'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'90001'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;allIds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, you have nested objects inside users.byId, and even deeper nesting inside address.&lt;/p&gt;

&lt;p&gt;When you update a user’s city, you need to carefully create new objects for every level that changed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;updatedState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'San Francisco'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you forget to create a new &lt;code&gt;address&lt;/code&gt; object or a new user object, React or Redux won’t see the change because the references at those levels are unchanged. Your UI won’t re-render as expected.&lt;/p&gt;

&lt;p&gt;This is a subtle and common source of bugs. Deep nesting means more spots to accidentally mutate or fail to shallow-copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  State Normalization: Flattening for Predictable Updates
&lt;/h2&gt;

&lt;p&gt;State normalization is the idea of storing your data in flat structures, usually keyed by IDs, avoiding nested objects that represent entities inside entities.&lt;/p&gt;

&lt;p&gt;In the users example above, the state is partially normalized already:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;users.byId&lt;/code&gt; maps IDs to user objects&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;users.allIds&lt;/code&gt; lists all user IDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But you can go further. For example, instead of nesting the &lt;code&gt;address&lt;/code&gt; inside the user object, flatten it out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Alice'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;addressId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'a1'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'2'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Bob'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;addressId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'a2'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;allIds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;addresses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s1"&gt;'a1'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'NYC'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'10001'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'a2'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'LA'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'90001'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;allIds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'a1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'a2'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, updating just the city in an address is a matter of replacing one small object in &lt;code&gt;addresses.byId&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;updatedState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;addresses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;addresses&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;addresses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'a1'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;addresses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'a1'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'San Francisco'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the update is shallow and localized, change detection works smoothly, and your UI updates reliably.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Normalized State Shapes Change Detection and Rerendering
&lt;/h2&gt;

&lt;p&gt;React and Redux rely on shallow equality checks for performance. When you pass a new prop or state slice to a component, React compares references. If the reference is the same, React skips re-rendering.&lt;/p&gt;

&lt;p&gt;Nested state deeply complicates this because you have to create new objects at every nesting level that changed, or React won’t detect any difference.&lt;/p&gt;

&lt;p&gt;Normalized, flat state makes your change detection predictable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You know exactly which entities changed by their IDs&lt;/li&gt;
&lt;li&gt;Updates are localized and shallow&lt;/li&gt;
&lt;li&gt;Components can subscribe to specific slices without fear of unrelated parts causing re-renders&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a &lt;code&gt;UserCard&lt;/code&gt; component can subscribe only to &lt;code&gt;users.byId[userId]&lt;/code&gt; and re-render only when that user object changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Runtime Mechanisms: How Updates Percolate Through the UI
&lt;/h2&gt;

&lt;p&gt;In frameworks like React, when you call &lt;code&gt;setState&lt;/code&gt; or dispatch an action that replaces a slice of state, React schedules a re-render for components that depend on that state.&lt;/p&gt;

&lt;p&gt;With normalized state, selectors or hooks typically do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When &lt;code&gt;state.users.byId[userId]&lt;/code&gt; changes reference, React re-renders that component.&lt;/p&gt;

&lt;p&gt;But with nested state, if you update a deeply nested property without replacing the top-level user object, the selector returns the same object reference, so React skips the update even though the nested data changed.&lt;/p&gt;

&lt;p&gt;This subtlety is why flat, normalized state is a practical win.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging State Mutation Bugs: Practical Tips
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Watch for Direct Mutations
&lt;/h2&gt;

&lt;p&gt;A classic bug is mutating nested objects directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byId&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'San Francisco'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This breaks immutability guarantees and fools React/Redux change detection.&lt;/p&gt;

&lt;p&gt;Use tools like Immer or deep-freeze in development to catch mutations early.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use DevTools to Inspect State References
&lt;/h2&gt;

&lt;p&gt;Redux DevTools and React DevTools allow you to monitor state changes and component re-renders.&lt;/p&gt;

&lt;p&gt;If a component doesn’t update when you expect, inspect the object references it receives. If the reference hasn’t changed, your update probably didn’t produce a new object.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Normalize Your Data From the Start
&lt;/h2&gt;

&lt;p&gt;If you start with nested state and later refactor to normalized state, you’ll find debugging easier and performance better.&lt;/p&gt;

&lt;p&gt;Libraries like normalizr and Redux Toolkit’s &lt;code&gt;createEntityAdapter&lt;/code&gt; help automate normalization.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Selectors Are Your Friends
&lt;/h2&gt;

&lt;p&gt;Use memoized selectors (e.g., Reselect) to efficiently map normalized state slices to component props, avoiding unnecessary recalculations and re-renders.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Nested State Still Makes Sense
&lt;/h2&gt;

&lt;p&gt;Normalization isn’t a silver bullet. Sometimes deeply nested state models natural hierarchies, like a tree of UI components or documents with nested sections.&lt;/p&gt;

&lt;p&gt;In those cases, you must be extra careful with immutable updates and ensure you replace parent objects when children change.&lt;/p&gt;

&lt;p&gt;Also, some frameworks (like MobX or Zustand) track mutations differently and may tolerate nested state better.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;If your UI updates feel flaky or your debugging sessions revolve around elusive stale props, check your state shape.&lt;/p&gt;

&lt;p&gt;Flatten your state where you can. Normalize your data. Make immutable updates shallow and predictable.&lt;/p&gt;

&lt;p&gt;It pays off in simpler change detection, fewer bugs, and snappier rendering.&lt;/p&gt;

&lt;p&gt;Next time your UI refuses to update, inspect state references first, this tiny insight might save you hours.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.dev/" rel="noopener noreferrer"&gt;web.dev performance guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;React documentation&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/state-normalization-in-frontend-architecture-mechanisms-and-debugging-of-flat-vs-nested-state-trees" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>statemanagement</category>
      <category>frontend</category>
      <category>uiarchitecture</category>
      <category>debugging</category>
    </item>
    <item>
      <title>The Browser’s Role in Managing Keyboard Focus Order and Tabindex with Shadow DOM</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:09:54 +0000</pubDate>
      <link>https://dev.to/mspk97/the-browsers-role-in-managing-keyboard-focus-order-and-tabindex-with-shadow-dom-5e10</link>
      <guid>https://dev.to/mspk97/the-browsers-role-in-managing-keyboard-focus-order-and-tabindex-with-shadow-dom-5e10</guid>
      <description>&lt;p&gt;You’ve built a nice web component with Shadow DOM, wired up some tabindex attributes, and expected keyboard users to tab smoothly through your controls. But then you notice the focus order is weird ,  tab jumps unexpectedly inside your shadow root or skips an element altogether.&lt;/p&gt;

&lt;p&gt;I ran into this exact puzzle recently and had to dig deep into how browsers manage keyboard focus when Shadow DOM is involved. It’s more subtle than you think.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Usual Suspect: tabindex and Focus Order
&lt;/h2&gt;

&lt;p&gt;We all know tabindex controls whether an element can receive keyboard focus and its order in the tab sequence:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;tabindex="0"&lt;/code&gt; means the element is focusable in natural document order&lt;/li&gt;
&lt;li&gt;Positive tabindex values (e.g. &lt;code&gt;tabindex="2"&lt;/code&gt;) reorder focus explicitly&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tabindex="-1"&lt;/code&gt; makes the element programmatically focusable but skips it in tab order&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In a simple page, this mostly works as expected. Tab moves through focusable elements in increasing tabindex order, then through elements with tabindex=0 in document order.&lt;/p&gt;

&lt;p&gt;But what happens when Shadow DOM enters the picture?&lt;/p&gt;

&lt;h2&gt;
  
  
  Shadow DOM and Focus: The Hidden Boundary
&lt;/h2&gt;

&lt;p&gt;Shadow DOM encapsulates markup so your component’s internals don’t leak out and accidentally clash with the page’s global styles or scripts. But keyboard focus needs to cross this boundary smoothly.&lt;/p&gt;

&lt;p&gt;Browsers handle this with the concept of &lt;strong&gt;focus delegation&lt;/strong&gt;. When you tab into a shadow host, the browser decides which element inside the shadow tree should receive focus first.&lt;/p&gt;

&lt;p&gt;Here’s the catch: this delegation depends on the shadow root’s &lt;code&gt;delegatesFocus&lt;/code&gt; flag (set when you create the shadow root) and the tabindex attributes inside.&lt;/p&gt;

&lt;p&gt;If the shadow root delegates focus, tabbing into the host moves the focus inside to the first focusable element (usually the first tabindex=0 element). If not, focus stays on the host element.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Browsers Compute Focus Order Across Light and Shadow DOM
&lt;/h2&gt;

&lt;p&gt;When you press Tab, the browser builds a list of all focusable elements to determine where to move next. But this list isn’t flat or simple when Shadow DOM is involved.&lt;/p&gt;

&lt;p&gt;Here’s roughly what happens under the hood:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flattened DOM Traversal:&lt;/strong&gt; The browser walks through the light DOM and includes shadow trees by "flattening" them ,  as if the shadow tree’s nodes appear inline inside the host.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tabindex Sorting:&lt;/strong&gt; All focusable elements with positive tabindex values are sorted in ascending order first.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document Order:&lt;/strong&gt; Then elements with tabindex=0 are visited in document order.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Focus Delegation:&lt;/strong&gt; For shadow hosts with delegated focus, the browser replaces the host element in the tab sequence with the first focusable element inside its shadow tree.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This sounds straightforward but subtle bugs creep in when tabindex values are mixed between light and shadow DOM, or when the shadow root doesn’t delegate focus.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Quirks and Gotchas
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Positive Tabindex in Shadow Tree vs Light DOM
&lt;/h2&gt;

&lt;p&gt;If you set &lt;code&gt;tabindex="1"&lt;/code&gt; inside a shadow tree and have &lt;code&gt;tabindex="2"&lt;/code&gt; on a light DOM element, the shadow tree element gets focused first ,  even if it’s visually after the light DOM element.&lt;/p&gt;

&lt;p&gt;This can confuse users if the visual order and focus order don’t match.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Shadow Root Without delegatesFocus
&lt;/h2&gt;

&lt;p&gt;By default, most shadow roots don’t delegate focus. So when you tab onto a shadow host, the focus lands on the host element, not inside.&lt;/p&gt;

&lt;p&gt;If your host isn’t focusable (no tabindex or programmatic focus), it might get skipped entirely, making inner shadow elements unreachable by keyboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Dynamic tabindex Changes
&lt;/h2&gt;

&lt;p&gt;Changing tabindex values dynamically inside shadow trees can confuse the browser’s focus traversal cache, causing unexpected tab stops or skipped elements until a page reload.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Nested Shadow DOM
&lt;/h2&gt;

&lt;p&gt;When shadow roots are nested, focus delegation chains. The browser must find the first focusable element in the deepest shadow tree. If any shadow root in the chain doesn’t delegate focus, that subtree is skipped.&lt;/p&gt;

&lt;p&gt;This is why sometimes keyboard navigation feels broken in complex component hierarchies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Keyboard Focus Order with DevTools
&lt;/h2&gt;

&lt;p&gt;Here’s a practical way to untangle mysterious focus order issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use the &lt;strong&gt;Elements panel&lt;/strong&gt; to inspect tabindex attributes on both light and shadow DOM nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Toggle the &lt;code&gt;delegatesFocus&lt;/code&gt; flag by recreating the shadow root in the console (if you control the component). Example:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my-component'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;oldShadow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shadowRoot&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;newShadow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attachShadow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'open'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;delegatesFocus&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;newShadow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;oldShadow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;childNodes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use the &lt;strong&gt;Accessibility pane&lt;/strong&gt; in DevTools to view the tab order and keyboard focusable elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Manually tab through the page and watch the focused element in DevTools to see where focus lands.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Experiment by adding or removing tabindex attributes and observe how the focus order changes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tips for Reliable Focus Management in Shadow DOM
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Prefer &lt;strong&gt;delegatesFocus: true&lt;/strong&gt; on your shadow roots if your component contains interactive elements users must tab into.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep tabindex values consistent and avoid mixing positive tabindex values between light and shadow DOM to prevent confusing focus sequences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use tabindex="0" for natural tab order and tabindex="-1" for elements to be focused programmatically only.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When building composite components, consider implementing explicit focus management in JavaScript, e.g., handling &lt;code&gt;focus&lt;/code&gt; and &lt;code&gt;keydown&lt;/code&gt; events to move focus manually.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test keyboard navigation with screen readers and accessibility tools to catch surprises early.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Keyboard focus in the presence of Shadow DOM isn’t magic ,  it’s a carefully orchestrated interplay between the browser’s flattened DOM traversal, tabindex sorting, and focus delegation rules.&lt;/p&gt;

&lt;p&gt;Understanding these mechanisms helps you spot why tabbing might behave unexpectedly and empowers you to build accessible, keyboard-friendly web components.&lt;/p&gt;

&lt;p&gt;Next time your tab order breaks in a shadow-rooted component, remember: check the tabindex values inside and outside the shadow tree, confirm if delegatesFocus is enabled, and walk through the flattened DOM order. It’s usually a subtle mismatch or a missing flag that’s throwing the browser off.&lt;/p&gt;

&lt;p&gt;Getting this right means your components play nice with keyboard users and assistive technologies ,  a win for everyone.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/" rel="noopener noreferrer"&gt;W3C WAI accessibility guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/w3schools-com" rel="noopener noreferrer"&gt;W3Schools accessibility tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/the-browser-s-role-in-managing-keyboard-focus-order-and-tabindex-with-shadow-dom" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>a11y</category>
      <category>keyboard</category>
      <category>focusmanagement</category>
      <category>shadowdom</category>
    </item>
    <item>
      <title>How Budgeting Resources for First Input Delay Can Backfire: Tradeoffs and Debugging</title>
      <dc:creator>Srikar Phani Kumar Marti</dc:creator>
      <pubDate>Mon, 16 Nov 2026 11:46:40 +0000</pubDate>
      <link>https://dev.to/mspk97/how-budgeting-resources-for-first-input-delay-can-backfire-tradeoffs-and-debugging-ngh</link>
      <guid>https://dev.to/mspk97/how-budgeting-resources-for-first-input-delay-can-backfire-tradeoffs-and-debugging-ngh</guid>
      <description>&lt;p&gt;You’ve just added a performance budget for your app’s First Input Delay (FID), feeling confident this will keep your UI snappy. But soon, you notice weird regressions: your page’s rendering seems slower, data fetches lag, or sometimes input responsiveness actually worsens.&lt;/p&gt;

&lt;p&gt;What gives? How can trying to keep input delay low actually backfire?&lt;/p&gt;

&lt;p&gt;I ran into this myself while tuning a client project. The key surprise was learning how budget tradeoffs between input handling, rendering, and network tasks can mess up overall performance if you don’t carefully balance priorities.&lt;/p&gt;

&lt;p&gt;Let me walk you through the mechanics under the hood, what causes these regressions, and practical ways to debug and fix them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Moment You Set a Tight Budget for First Input Delay
&lt;/h2&gt;

&lt;p&gt;Performance budgets are great for keeping user experience in check. Setting a target like "FID under 100ms" feels straightforward: input event handlers must complete quickly.&lt;/p&gt;

&lt;p&gt;So you audit your handlers, slice down long-running JavaScript, defer expensive work, split tasks into microtasks or idle callbacks, and voilà ,  input callbacks run faster.&lt;/p&gt;

&lt;p&gt;But then something odd happens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The main thread gets busier with rendering tasks that now run later or all at once.&lt;/li&gt;
&lt;li&gt;Data fetching feels delayed or blocked.&lt;/li&gt;
&lt;li&gt;Input responsiveness in the wild feels jittery, not smooth.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s frustrating because your improvements look good on paper.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Happens: The Tug of War Between Tasks
&lt;/h2&gt;

&lt;p&gt;Browsers handle everything on a single main thread: input events, JavaScript, rendering, and network response handling. If you speed up input handlers by deferring work, that work piles up elsewhere.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You might postpone rendering updates to after input handlers finish.&lt;/li&gt;
&lt;li&gt;This can cause a burst of rendering work later, blocking next frames.&lt;/li&gt;
&lt;li&gt;Network response callbacks waiting on the main thread get delayed too.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, budget gains in one area can cause congestion in another.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is First Input Delay, Really?
&lt;/h2&gt;

&lt;p&gt;First Input Delay measures the time from when a user first interacts (like clicking or typing) to when the browser is able to respond.&lt;/p&gt;

&lt;p&gt;Crucially, it includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The time JavaScript takes to run event handlers&lt;/li&gt;
&lt;li&gt;Any prior tasks blocking the main thread&lt;/li&gt;
&lt;li&gt;The time until the browser can actually process the input&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if you have a long task running before the input event fires, FID suffers.&lt;/p&gt;

&lt;p&gt;But if you trim input handlers by deferring work, you might shift bottlenecks to rendering or other tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Concrete Example: Deferring Work Can Move CPU Usage
&lt;/h2&gt;

&lt;p&gt;Imagine your input handler does:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'click'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;doCriticalWork&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;scheduleRenderingUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To improve FID, you refactor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'click'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;doCriticalWork&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;requestIdleCallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;renderUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the input handler finishes faster, so FID looks better. But the rendering update happens later in idle time, possibly batching many updates.&lt;/p&gt;

&lt;p&gt;This batch can cause a long main thread task afterward, blocking subsequent input events or network callbacks.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Spot These Tradeoffs in DevTools
&lt;/h2&gt;

&lt;p&gt;Use the Performance tab in Chrome DevTools to record a session with input interactions.&lt;/p&gt;

&lt;p&gt;Look for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Long task bars colored red (blocking input)&lt;/li&gt;
&lt;li&gt;Clusters of rendering work that come right after input handlers&lt;/li&gt;
&lt;li&gt;Deferred tasks scheduled by requestIdleCallback or setTimeout&lt;/li&gt;
&lt;li&gt;Network request callbacks delayed due to main thread congestion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You might see input handlers finish quickly, but right after, a big chunk of rendering or JavaScript runs, causing jank.&lt;/p&gt;

&lt;h2&gt;
  
  
  Strategies to Balance Budgets and Avoid Backfire
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Prioritize tasks carefully:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Not all deferred work is equal. Rendering updates that affect input responsiveness should not be delayed too long.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Split rendering work into smaller chunks:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead of one big batch later, break rendering into microtasks or animation frame callbacks to keep the main thread responsive.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Use browser scheduling APIs wisely:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;requestAnimationFrame&lt;/code&gt; is better for rendering updates than &lt;code&gt;requestIdleCallback&lt;/code&gt; when you want smoothness.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Monitor not just FID but also Total Blocking Time and Interaction to Next Paint:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These metrics give a fuller picture of perceived responsiveness.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Test on real slow devices and network conditions:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Bottlenecks can shift dramatically depending on CPU and network speeds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Record multiple profiles:&lt;/strong&gt; Capture several input events and look for patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check event timestamps:&lt;/strong&gt; See when input events fire versus when handlers run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use &lt;code&gt;PerformanceObserver&lt;/code&gt;:&lt;/strong&gt; Observe long tasks and task scheduling in real time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Experiment with removing deferred work:&lt;/strong&gt; Does input responsiveness improve or degrade?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audit third-party scripts:&lt;/strong&gt; They often introduce hidden long tasks that cause input delays.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Learned From My Debugging Journey
&lt;/h2&gt;

&lt;p&gt;Just focusing on input handler duration can be misleading. Sometimes making handlers ultra-fast just shifts lag elsewhere.&lt;/p&gt;

&lt;p&gt;Balancing input responsiveness with smooth rendering and timely data fetching is a juggling act.&lt;/p&gt;

&lt;p&gt;Understanding the browser’s event loop, task queues, and scheduling APIs helps you make informed tradeoffs.&lt;/p&gt;

&lt;p&gt;And remember: the goal is not just a single metric number but a genuinely smooth, snappy experience.&lt;/p&gt;

&lt;p&gt;If you budget FID without considering rendering and network workloads, you might end up with a UI that’s responsive to the first tap but chokes on the next.&lt;/p&gt;

&lt;p&gt;Approach performance holistically, profile end to end, and use budgets as guidance, not absolute rules.&lt;/p&gt;

&lt;p&gt;You’ll find that input latency budgeting is less about strict limits and more about smart orchestration of all main thread work.&lt;/p&gt;




&lt;h2&gt;
  
  
  Helpful learning resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/" rel="noopener noreferrer"&gt;W3C WAI accessibility guidance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/w3schools-com" rel="noopener noreferrer"&gt;W3Schools accessibility tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;
Originally published at &lt;a href="https://blog.mspk.me/posts/how-budgeting-resources-for-first-input-delay-can-backfire-tradeoffs-and-debugging" rel="noopener noreferrer"&gt;Under The Hood&lt;/a&gt;.
Get the next deep dive in your inbox: &lt;a href="https://blog.mspk.me/#subscribe" rel="noopener noreferrer"&gt;subscribe to Under The Hood&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>frontendperformance</category>
      <category>inputlatency</category>
      <category>performancebudgets</category>
      <category>debugging</category>
    </item>
  </channel>
</rss>
