Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 18, 2025

This PR introduces a new Dialog component that serves as a modern replacement for the Modal component, leveraging native HTML5 <dialog> elements and modern CSS properties for improved performance and accessibility.

Key Features

Native HTML5 Dialog Element

The new Dialog component uses the semantic <dialog> element instead of plain HTML divs, providing:

  • Built-in browser accessibility features
  • Native focus management
  • Semantic markup for screen readers
  • Better keyboard navigation support

Modern CSS with scrollbar-gutter

Replaces manual scrollbar width detection with the scrollbar-gutter: stable CSS property:

  • Eliminates JavaScript-based scrollbar width calculations
  • Provides consistent scrollbar space reservation
  • Better performance with no layout shifts
  • Works across all modern browsers

Modal and Non-Modal Support

The Dialog component supports both interaction modes through a new modal option:

  • Modal dialogs (default): Use dialog.showModal() to block page interaction
  • Non-modal dialogs: Use dialog.show() to allow background interaction

Implementation

JavaScript Component (js/src/dialog.js)

  • Maintains the same API structure as the existing Modal component
  • Supports all existing configuration options: backdrop, focus, keyboard
  • Adds new modal option to control dialog behavior
  • Uses native dialog methods (showModal(), show(), close())

CSS Styles (scss/_dialog.scss)

  • Complete responsive styling system
  • Supports all existing Modal features (sizes, fullscreen, scrollable)
  • Uses scrollbar-gutter for consistent scrollbar handling
  • Custom backdrop styling with dialog-backdrop class

Comprehensive Testing

  • Full test suite with 769 passing tests
  • Tests for modal/non-modal behavior
  • Backdrop interaction testing
  • Focus management validation
  • API compatibility verification

Usage Examples

Basic Modal Dialog

<dialog class="dialog fade" id="exampleDialog">
  <div class="dialog-content">
    <div class="dialog-header">
      <h5 class="dialog-title">Dialog Title</h5>
      <button type="button" class="btn-close" data-bs-dismiss="dialog"></button>
    </div>
    <div class="dialog-body">
      Dialog content goes here.
    </div>
  </div>
</dialog>

Non-Modal Dialog

const nonModalDialog = new bootstrap.Dialog(element, {
  modal: false,
  backdrop: false
});

Browser Support

The Dialog component leverages the native <dialog> element which is supported in all modern browsers. The scrollbar-gutter property provides progressive enhancement with fallback behavior.

Migration Path

The Dialog component maintains API compatibility with the existing Modal component, making it easy to adopt as a drop-in replacement while gaining the benefits of native dialog functionality.

![Modal Dialog Demo](https://github.com/user-attachments/assets/32ea7e4e-d45e-444a-9043-d801905d8e01)

The screenshot shows the Dialog component in action, demonstrating the modal dialog with backdrop and proper styling using the native HTML5 <dialog> element.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • accounts.google.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • android.clients.google.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • clients2.google.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • clientservices.googleapis.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • optimizationguide-pa.googleapis.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • redirector.gvt1.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • safebrowsingohttpgateway.googleapis.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
  • www.google.com
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3795 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-80321160 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2107222210045699955,1609544903048714745,262144 --disable-features=PaintHolding --variations-seed-version (dns block)
    • Triggering command: /opt/google/chrome/chrome --user-data-dir=/tmp/karma-80321160 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=80321160 (dns block)
    • Triggering command: /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4100 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-15075696 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,17951303586872664960,10623212525715332264,262144 --disable-features=PaintHolding --variations-seed-version (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

mdo and others added 17 commits September 15, 2025 17:35
* Don't disallow calc()

* Remove disables that aren't needed

* Remove custom subtract and add functions

* Remove more disables

* keep it here
* Convert .ratio helper to new .ratio utility

* Fix up

* Fix links for now, even though they'll be deleted
* Drop clearfix for display: flow-root

* Fix links
#41687)

* Rename mh-* and mw-* to max-h/w-*, add additional width and height values

Fixes #41330, fixes #40674.

* Bump bundlewatch
* Remove all deprecated Sass variables and deprecation notices from docs components

* Fix linter error

* fix
* Remove added badges from docs pages

* Remove AddedIn
…s and extra dependencies once we migrate to Sass modules (#41697)
* Reorganize scss folder

* Migrate to Sass modules

* Migrate docs to Sass modules, comment out docs grid CSS

* Give helpers folder an index.scss, migrate ratio helper to aspect-ratio utility

* Delete node sass Action

* Modify Sass tests to pass for new Sass modules implementation

* Don't disallow calc()

* Move heading classes back to Reboot to prevent a dependency

* Utilities, some helpers, and theme colors

* Temporary fix of docs compilation

* Temporary Bundlewatch fix

* docs fix import to use

* Restyle docs callouts

* Fix docs colors

* Revert typo

* Reintroduce `css-lint-vars` npm script

* Bump to Sass v1.90.x

* Fixes

* more

* Remove

---------

Co-authored-by: Julien Déramond <[email protected]>
* First pass at CSS layers

* bundlewatch

* more bundlewatch
…41702)

* Restore both grids and update mixins

* Bundlewatch
* Co-locate Sass variables in most files

* another

* fix

* Don't bring tables into reboot, temp remove some sass vars so we don't need the co-dependency

* Move vars

* bundlewatch

* scssdocs

* Fix scssdocs
@Copilot Copilot AI changed the title [WIP] Let’s build a replacement for the Modal component. We should maintain almost all functionality, options, and code style. Instead of using plain HTML, let’s use the new dialog element. Instead of manually detecting scrollbar size, use the new scroll... Add Dialog component using native HTML5 dialog element and scrollbar-gutter Sep 18, 2025
@Copilot Copilot AI requested a review from mdo September 18, 2025 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants