Diving Into the Toplayer: Where Dialogs, Popovers, and Modals Live

Bookmark
Rate this content

The web platform is evolving, introducing powerful new primitives that change how we build interfaces. Among these innovations is the toplayer – an important yet often misunderstood rendering concept. This talk explores the toplayer rendering mechanism, learning how it enables UI patterns and examining its role in accessibility, performance, and developer experience.

The toplayer isn't just another technical specification—it represents a shift in how browsers handle elements that need to break out of the normal document flow. From dialog elements to the new popover API, custom tooltips to modal interfaces, the toplayer has quietly become essential for creating modern web experiences. By understanding how the toplayer works, developers can build more robust, accessible, and maintainable components while avoiding common pitfalls that lead to inconsistent user experiences.

In this session, we'll dive into the toplayer to understand how browsers handle stacking contexts, painting order, and focus management within the toplayer. Through practical examples and live coding demonstrations, attendees will gain both theoretical understanding and practical skills they can apply to their own projects.

This talk has been presented at JSNation US 2025, check out the latest edition of this JavaScript Conference.

FAQ

Tim Dame's talk focuses on the top layer of web design, particularly dialogues, popovers, and models, and how they overlap content on the web.

Dialogue elements were not widely used before 2020 because they were only supported in Chrome and had numerous accessibility issues, making them an impractical choice for web developers.

A popover is an HTML attribute that creates a floating overlay for providing information or actions, appearing above the main content without blocking the user's workflow.

A popover appears above the main content without blocking the user's workflow and uses light dismiss, whereas a modal dialogue requires user interaction to proceed and uses explicit dismiss.

The dialogue element automatically adds a role of dialogue for accessibility, allows opening as a modal or non-modal, supports closing with the escape key, and manages focus trapping when used as a modal.

The top layer provides a dedicated layer above the main document for content like dialogues and popovers, eliminating the complexity and limitations of using Z-index for positioning overlays.

The maximum Z-index value is about 2 billion, which is the largest number that can be stored in a 32-bit integer, marking the limit for Z-index values in web development.

Tim Dame is a frontend chapter lead at ABN AMRO, a Dutch bank, and an advocate for web accessibility. He is also a host of the "Focus Trap" podcast, discussing digital accessibility and web development.

Using Z-index for overlay content can lead to a "Z-index mess," where complex web applications end up with conflicting Z-index values, causing issues in content layering.

The dialogue element in HTML supports automatic role assignment for screen readers, focus management by focusing the first interactable element, and trapping focus within modal dialogues for better accessibility.

Tim Damen
Tim Damen
33 min
20 Nov, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Online talk discussing web overlays, ads, models, and cookie banners. Focus on dialogues, popovers, and their history in web design. Emphasis on accessibility and successful UI strategies. Introduction of non-modal dialogues and popovers in web design. Insights on implementing model dialogues, popovers, and managing Z-index values. Exploration of Z-index challenges, top layer concepts, and dialogue accessibility. Analysis of dialogue opening, focus management, and urgent model dialogues. Implementation of advanced popover features, CSS anchor usage, and dialogue comparisons.
Video transcription and chapters available for users with access.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

The State of the Web
JSNation 2025JSNation 2025
32 min
The State of the Web
Sasha Grief discusses the state of the web through web development surveys, leading to an interactive quiz about the state of JS and usage of front end frameworks. Discussion on popular front-end libraries like React, Vue, Angular, and the rising popularity of TypeScript among developers in recent surveys. Discussion on TypeScript adoption, TC39 committee proposals, favorite CSS feature 'has,' and browser support for 'has' selector. Browser interoperability, browser vendors' initiatives, AI usage among web developers, and survey insights. Job titles linked to higher income, diversity of survey topics, top hobby among developers, and popular specific video games. Learnings on CSS features, TypeScript default, AI usage, survey benefits, challenges in reaching diverse survey participants. Surprising positivity in JavaScript usage, stable framework landscape, AI adoption challenges, mainstream AI tools, successful situp.js survey. Inconsistent respondent numbers, manual data normalization efforts, subjective question selection process, community input, mitigation of selection bias. Reason for starting surveys, transition from Meteor JS, exploration of JavaScript ecosystem.
Remix: Embracing Web Standards to Redefine Modern Web Development
React Advanced 2023React Advanced 2023
26 min
Remix: Embracing Web Standards to Redefine Modern Web Development
Top Content
Watch video: Remix: Embracing Web Standards to Redefine Modern Web Development
Remix is a web development framework that combines the scalability of server-rendered frameworks with the flexibility of React. It prioritizes web standards and best practices for security. Remix streamlines development with web standards like URLs, fetch API, HTML, and HTTP caching. It simplifies data handling through HTML forms and HTTP, improving user experience. Httpication in Remix reduces server load and speeds up response time, while global search and Storyblock make building complex websites easier.
What is "TC39: Type Annotations" aka the Types as Comments proposal
TypeScript Congress 2023TypeScript Congress 2023
27 min
What is "TC39: Type Annotations" aka the Types as Comments proposal
Top Content
The TC59 Type Annotations proposal, also known as Types with Comments, introduces the ability to run typed code in JavaScript. It aims to bring TypeScript back into JavaScript and create a separation between type system and runtime. TypeScript's popularity is on par with JavaScript, raising concerns about the influence of Microsoft. The proposal progresses by addressing runtime interaction and token soup in type specifications. Research, community involvement, and quantifying the effects of supporting this comment style are important goals.
Temporal: The Curious Incident of the Wrong Nighttime
JSNation 2025JSNation 2025
25 min
Temporal: The Curious Incident of the Wrong Nighttime
Speaker's involvement in Temporal proposal and TC39 meetings for JavaScript standardization. Date conversion challenges faced in development. Addressing time zone discrepancies with Temporal to prevent bugs. Exploration of Temporal types and design philosophy. Usage of Java's time zone serialization in JavaScript Temporal. Challenges in implementing Temporal proposal and its transformative potential in ECMAScript.
Superpowers of Browser’s Web API
React Advanced 2023React Advanced 2023
23 min
Superpowers of Browser’s Web API
Watch video: Superpowers of Browser’s Web API
Today's Talk explores various Web APIs and their functionalities, including the Intersection Observer API for element visibility, the Network API for connection detection, and the Background Sync API for offline capabilities. The Broadcast Channel API enables communication between components and the Beacon, Web Speech, Web Share, Screen Awake Lock, Page Visibility, Background Fetch, and Web Authentication APIs offer additional functionalities. These standardized APIs work across browsers and can improve performance while reducing electricity consumption.
Web Push Notifications Done Right
JSNation 2023JSNation 2023
11 min
Web Push Notifications Done Right
Let's talk about web push notifications and their benefits. Web push notifications have higher opt-in and click rates compared to traditional methods. The web push API should be used responsibly, with subscription requests initiated only after explicit user action. Improve engagement by using emojis in notifications. Connect with the speaker on LinkedIn for more information about the web push API.