Skip to content

[Modal] Allow dynamic configs by reevaluating its properties on show #39290

@TomONeill

Description

@TomONeill

Prerequisites

Proposal

My proposal is to reevaluate the passed options to the Modal constructor when show() is called.

A perfect working example of this is how Tooltip handles certain properties, like placement or title.

{
  "placement": () => this.placement,
  "title": () => this.title
}

I'd like to see similar behaviour for the modal, like so:

{
  "backdrop": () => this.shouldShowBackdrop,
  "focus": () => this.shouldFocus,
  "keyboard": () => this.allowKeyboard,
}

Motivation and context

We're creating a modal using its constructor early in the runtime of the application. Then at later points in time, we pass dynamic content to the modal and then call show. The only problem with this approach is that we can't change any of the configuration initially passed into the constructor, like keyboard, once the modal instance was created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions