twbs / twbs/bootstrap

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

Open
#39,290 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature js
Dominant language
MDX
Stars
175k
Forks
78.6k
Avg merge
7h 19m
Merged PRs (30d)
35

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Modal constructor and show() behavior described in the issue, then compare how Tooltip reevaluates properties such as placement and title. Done means configuration values supplied to Modal can be reevaluated when show() is called, including the dynamic backdrop, focus, and keyboard examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.