Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popover JS config object overrides data-bs- attributes #37298

Closed
3 tasks done
daviddwmd opened this issue Oct 11, 2022 · 1 comment · Fixed by #37303
Closed
3 tasks done

Popover JS config object overrides data-bs- attributes #37298

daviddwmd opened this issue Oct 11, 2022 · 1 comment · Fixed by #37303

Comments

@daviddwmd
Copy link

Prerequisites

Describe the issue

The Bootstrap v5.2 documentation for Popovers says that the "content" option in the config object passed to the JS initialization provides "Default content value if data-bs-content attribute isn’t present." But when the data-bs-content attribute IS present, the Popover is still using the default from the JS config, and ignoring the data-bs-content. I'd like to use a function on most of my Popovers by default, but be able to override the default using the data attributes.

The issue is happening on lines 46-47 of util/config.js, where the _mergeConfigObj loads the data attributes, then the js config.

Per this StackOverflow item, this has been happening since v3: https://stackoverflow.com/questions/28593579/override-popover-option-parameter-with-data-attributes

Am I just misunderstanding the documentation? Shouldn't the HTML be a more specific case than the JS?

Reduced test cases

https://codepen.io/asleepypenguin/pen/eYrbBam

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

No response

What version of Bootstrap are you using?

v5.2.0

@julien-deramond julien-deramond moved this to To do in v5.3.0 Oct 11, 2022
@julien-deramond julien-deramond changed the title Popover JS config object overrides data-bs- attributes Popover JS config object overrides data-bs- attributes Oct 11, 2022
@GeoSot GeoSot added the docs label Oct 12, 2022
@GeoSot
Copy link
Member

GeoSot commented Oct 12, 2022

Nice catch @daviddwmd. All our components, support data-bs parsing and on top of this the JS config can override everything, by design. So we need to fix our docs

@julien-deramond julien-deramond moved this from To do to Needs review in v5.3.0 Oct 19, 2022
@github-project-automation github-project-automation bot moved this from Needs review to Done in v5.3.0 Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants