Skip to content

Fix the datepicker menu when it opens from a dialog - #43097

Open
ump45nose wants to merge 2 commits into
twbs:mainfrom
ump45nose:cursor/datepicker-dialog-layer-c88c
Open

ump45nose wants to merge 2 commits into
twbs:mainfrom
ump45nose:cursor/datepicker-dialog-layer-c88c

Conversation

@ump45nose

Copy link
Copy Markdown

Description

The datepicker menu now opens inside an open dialog. It paints above the dialog and the backdrop.

Vanilla Calendar Pro appends the popup to the body. It sets left and top in page coordinates. A modal dialog and its backdrop use the top layer. A popup on the body paints under that layer. z-index cannot raise it.

The datepicker moves the popup into an open dialog when that dialog does not clip overflow. It then maps the page coordinates onto the dialog padding edge. A window resize keeps that place. Closing the dialog hides the datepicker.

Motivation & Context

A datepicker opened from a dialog shows its menu behind the backdrop. Fixes #43093.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

  • No docs page changes. The visual test is js/tests/visual/datepicker.html, section "Inside a dialog".

Related issues

Fixes #43093

Tests

  • npm run js-lint: exit 0. Six pre-existing warnings remain. This change adds none.
  • npm run js-typecheck: exit 0.
  • npx vitest run --config js/tests/vitest.config.mts --coverage: 34 files, 1366 tests passed.

Browser check with Playwright in Chromium and WebKit: the menu parent is the open dialog, hit tests on the menu (including over the backdrop) hit the menu, the menu lines up with the input when scrolled, and a date click fills the input and hides the menu. A non-modal dialog behaves the same.

This change was prepared with an AI coding agent and reviewed before submission.

Vanilla Calendar Pro appends the popup to the body.
A modal dialog and its backdrop sit in the top layer.
The popup paints under that layer.
Move the popup into the open dialog.

Co-authored-by: ump45nose <ump45nose@users.noreply.github.com>
@ump45nose
ump45nose requested a review from a team as a code owner October 16, 2026 07:26
@julien-deramond julien-deramond added v6 v6, the main branch bug Something does not work as documented js JavaScript or TypeScript sources and plugins labels Oct 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something does not work as documented js JavaScript or TypeScript sources and plugins v6 v6, the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Datepicker menu behind backdrop when launched from a dialog

3 participants