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.

1. Exploring Web Overlays and Cookie Banners

Short description:

Hello JS Nation. Online talk about dialogues, popovers, models. Web evolution with overlays, ads, and models. Video from 2021 showing overlay implementations and cookie banners worldwide.

Hello JS Nation. I'm so glad that you joined my online talk this year as well, my second year in a row to be on for the JS Nation US. So I'm glad to be here. We are going to talk about the top layer. We're going to dive into the top layer and we'll talk about dialogues, popovers, and models. So let's go.

And I want to take you back to a time where the web was more simple and when the web was flat, used to be flat, so no dynamic content, fancy animations, popups, popovers. Today the web can overlap and it does so a lot, I would say. We have models, popovers as well, dynamic content that pops up into the browser all of a sudden. And I brought a video as well as somewhat of an explanation.

This is already a little bit of an older video. It's from 2021. It says browsing the web in 2021, but I think it's still relevant today. Let me open it and see if you notice some things. And I will pause right here. So at the peak overlay, I would say, so what did we see? That this was actually a blog page and there was also some content in the middle. But there are, of course, a lot of ads, video ads, ads popping up in the middle of us browsing the page, two of them on the right and on the left. Of course, we had two banners as well.

So a register banner to register to this blog and, of course, the cookie banner. And then at the end, another model dialogue that popped up and it says, of course, sign on to my daily newsletter. So there are lots of overlay implementations on this webpage. All relatively newer features on the web, I would say. So yeah, there are definitely ways not to implement overlays. I also brought this video. This is an interview by Lex Friedman. He has DHH on, the creator of Ruby on Rails, and he talks about cookie banners. The thing that really gets me about cookie banners too, it's not just the EU, it's the entire world. You can't hide from cookie banners anywhere on this planet. If you go to god damn Mars on one of Elon's rockets and you try to access a webpage, you'll still see a cookie banner. No one in the universe is safe from this nonsense.

2. Unveiling Dialogues and Popovers in Web Design

Short description:

Focus on the history and implementation of dialogues and popovers in web design. Presented by Tim Dame, a frontend chapter lead at ABN AMRO, emphasizing accessibility and successful strategies for UI elements.

Probably the interface on the rocket. It's even slower. You'll have basically 150 second ping time. So it'll take you 45 seconds just to get through the cookie banners from Mars. Yeah. So cookie banners, models, dynamic ads. I think these are all actually awful UI element features today in the web space.

What my talk is about is about giving you the history of how the top layer came to be, why the dialogues and popovers are now in the top layer. And I'm going to give you also the basics to try to set you up for success on how to implement models and popovers.

My name is Tim Dame. I'm a frontend chapter lead at the ABN AMRO, that's a Dutch bank. And I'm also accessibility leader, and I advocate a lot for accessibility. In this talk, we will focus on the what, the why, and the how of content that overlaps other content focusing on the dialogue and the pop art.

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.