Skip to content

Allow keyed components to share an element - #42992

Open
mdo wants to merge 1 commit into
mainfrom
mdo/data-multiple-instances
Open

mdo wants to merge 1 commit into
mainfrom
mdo/data-multiple-instances

Conversation

@mdo

@mdo mdo commented Oct 7, 2026

Copy link
Copy Markdown
Member

What changed

  • Remove the Data.set() guard that rejected a second component key on the same element.
  • Remove the insertion-order-dependent Data.getAny() helper.
  • Look up tooltip, popover, and toast instances by their explicit keys when a dialog or drawer closes.
  • Cover keyed coexistence, independent disposal, Combobox/Menu registration and reuse, and overlay cleanup regardless of registration order.

Combobox intentionally composes a Menu on its toggle. Previously, bs.combobox registered first and the bs.menu registration failed. The Menu object still finished construction, but Menu.getOrCreateInstance() could not find it and created more unregistered Menu instances during keyboard handling.

Same-component replacement remains unchanged: constructing another instance with the same key still disposes the previous instance first.

Closes #42965

Tests

  • npm run js-test — 1,356 tests passed, including bundle and modularity integration builds
  • npm run js-typecheck
  • ESLint on changed files

Combobox creates a Menu on its toggle, but the Data guard rejects the
second component key. The Menu remains unregistered, so keyboard handling
creates additional instances and logs an error on every interaction.

Allow differently keyed instances to coexist while preserving same-key
replacement and independent disposal. Replace the ambiguous getAny lookup
in dialog cleanup with explicit component keys so overlays are hidden
regardless of registration order.
@mdo
mdo requested a review from a team as a code owner October 7, 2026 03:54
@mdo mdo added js JavaScript or TypeScript sources and plugins v6 v6, the main branch labels Oct 7, 2026
@mdo mdo added this to v6.0.0 Oct 7, 2026
@julien-deramond julien-deramond added the bug Something does not work as documented label Oct 10, 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

Status: Inbox

Development

Successfully merging this pull request may close these issues.

v6: Combobox logs "Bootstrap doesn't allow more than one instance per element. Bound instance: bs.combobox."

2 participants