Skip to content

Conversation

@dwgray
Copy link
Member

@dwgray dwgray commented Sep 15, 2024

Describe the PR

This PR addresses #2122 among other things. Since the bootstrap 5 behavior makes bg-variant and text-variant override variant (it's actually bg-* and text-* classes overriding text-bg-* classes) - the most straightforward was to solve this problem is to just all of the variant props set their respective classes and let bootstrap sort it out.

Small replication

See #2122

PR checklist

What kind of change does this PR introduce? (check at least one)

  • Bugfix 🐛 - fix(...)
  • Feature - feat(...)
  • ARIA accessibility - fix(...)
  • Documentation update - docs(...)
  • Other (please describe)

The PR fulfills these requirements:

  • Pull request title and all commits follow the Conventional Commits convention or has an override in this pull request body This is very important, as the CHANGELOG is generated from these messages, and determines the next version type. Pull requests that do not follow conventional commits or do not have an override will be denied

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 15, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/bootstrap-vue-next/bootstrap-vue-next@2200
pnpm add https://pkg.pr.new/bootstrap-vue-next/bootstrap-vue-next/@bootstrap-vue-next/nuxt@2200

commit: 56b138d

@VividLemon
Copy link
Member

VividLemon commented Sep 15, 2024

On the other hand, using variant with textvariant or bgvariant wouldn't make sense. It could make sense to flip the [text-bg-${props.variant}]: props.variant !== null, to [text-bg-${props.variant}]: props.variant !== null && (textVariant || bgVariant), check

One would never have variant and textVariant, so naturally even though it's "breaking", it wouldn't be 'breaking'

Which could naturally alleviate the issue as first, the two props are more specific, and second there are no non "undefined/null" props of those

@dwgray
Copy link
Member Author

dwgray commented Sep 15, 2024

On the other hand, using variant with textvariant or bgvariant wouldn't make sense. It could make sense to flip the [text-bg-${props.variant}]: props.variant !== null, to [text-bg-${props.variant}]: props.variant !== null && (textVariant || bgVariant), check

I agree that something like this could work better. I started to go down that path, and got tied up a bit because no matter what you do, we'll have some non-intuitive interactions.

Is what you're proposing that we set text-bg-variant if and only if the variant prop is set and neither the text-variant nor the bg-variant prop is set? Wouldn't that be?

[`text-bg-${props.variant}`]: props.variant !== null && !(textVariant || bgVariant),

If that is what you're thinking, then the only slightly odd thing is that if someone sets all three variant props, then variant will be ignored, but that seems like a lot more of a corner case than what we have now. Which is pretty much what you said above, I'm just processing...

I'll set this to draft and try going down that path (hopefully tomorrow)...

@VividLemon
Copy link
Member

Hypothetically one could remove the null check all together and just see what bootstrap does

@dwgray
Copy link
Member Author

dwgray commented Sep 15, 2024

Hypothetically one could remove the null check all together and just see what bootstrap does

Playing with BS5, text-variant and bg-variant take precedence over bg-text-variant. So I think the best course here is to just set the classes without trying to be smart and let BS5 handle it. I've probably over-documented the behavior, since it's fairly straightforward, but since I had most of this in place I just modified based on describing the BS5 behavior.

@dwgray dwgray force-pushed the variant-issues branch 2 times, most recently from b610108 to da58bca Compare September 15, 2024 16:17
@dwgray dwgray marked this pull request as ready for review September 16, 2024 14:20
@VividLemon VividLemon merged commit bb979ec into bootstrap-vue-next:main Sep 17, 2024
xvaara added a commit to xvaara/bootstrap-vue-next that referenced this pull request Sep 17, 2024
* upstream/main:
  doc(variant): interaction between variant, bg-variant & text-variant (bootstrap-vue-next#2200)
  chore: release main (bootstrap-vue-next#2206)
  fix(ConditionalWrapper): don't inherit attrs (bootstrap-vue-next#2205)
  docs: fix paths (bootstrap-vue-next#2204)
  chore: release main (bootstrap-vue-next#2196)
  fix: change renderorskip to wrapper, add our own teleport logic. (bootstrap-vue-next#2162)
  fix(BTable): Type check failed for prop tbodyTrClass fixes bootstrap-vue-next#2197 (bootstrap-vue-next#2198)
  fix(resolver): resolver path for BCloseButton
  feat(BCarousel): add noAnimation prop (bootstrap-vue-next#2194)
  docs: Migration Guide refactor (bootstrap-vue-next#2186)
  chore: release main (bootstrap-vue-next#2191)
  fix(BNavItem): pass prop exactActiveClass to router component (bootstrap-vue-next#2188)
  chore: release main (bootstrap-vue-next#2190)
  fix: improper import path (bootstrap-vue-next#2189)
@dwgray dwgray deleted the variant-issues branch December 9, 2024 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants