Hands-On: AI Swaps Hand-Rolled Modals for Native <dialog> After Installing Four-Browser Skill Pack
AI coding assistants are trained on stale patterns, so they keep producing legacy front-end code even when modern APIs exist. This vendor-backed skill pack gives assistants a reference that changes the output: native <dialog>, focus management, and Esc handling become the default, reducing accessibility and maintenance bugs in generated code.
A six-prompt experiment against GoogleChrome/modern-web-guidance shows what happens when an AI coding assistant is given a curated textbook of modern web standards. Before the skill, the AI produced a water-reminder modal with a hand-built overlay div, inline onclick handlers, and manual Esc handling. After installing the skill, the same requirement used the native <dialog> element with a single showModal() call, cutting roughly thirty lines and gaining browser-managed focus, backdrop dimming, and Esc behavior. The tooltip case swapped coordinate-tracking code for CSS anchor positioning, narrowing 60-100 lines down to three declarations.
The test then applied the skill to a real single-file sign-in page. The built-in legacy scanner reported zero hits, because it only flags rules it is sure about. A manual review against the textbook, however, found nine modals built with hand-rolled masks, fifty-plus inline event handlers, thirty-plus innerHTML assignments, and no Esc handling at all. Rewriting one modal to use <dialog> moved the mask styles into ::backdrop and eliminated the boilerplate; open and close become one line.
The maintainability win is not simply a shorter file. It is that the AI is no longer responsible for remembering correctness details like focus return and Esc handling, which are easy to forget and hard to test when you write them by hand. The skill effectively takes behaviors the browser already provides and removes them from the developer's code.
The skill's conservative scanner that reports zero on a codebase with 50+ inline handlers shows why automated legacy detection is limited; the textbook-based manual comparison is what actually surfaces those patterns.
The maintainability argument is about removing hidden correctness obligations, not just counting lines; that's why the AI's shift to native APIs is a bigger deal than the code savings suggest.
Four browser vendors cooperating on this package is notable because AI assistants have historically learned from mixed, outdated training data; a shared, current reference is a new mechanism for steering their output.