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

Fix progress-bar animation when overriding --bs-progress-height #40745

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Steve-Tech
Copy link

@Steve-Tech Steve-Tech commented Aug 19, 2024

Description

This PR stops the animation from jumping when overriding the height of progress-bar-animated progress bars using the --bs-progress-height variable (from another CSS file).

Motivation & Context

I needed a thicker progress bar for a project, but the animation jumped every second, giving it a broken look. Here's the CSS I was using, including a workaround:

#status-card .progress {
    --bs-progress-height: 2rem;
}

/* Fix jumpiness of progress bar when height is non-default */
@keyframes progress-bar-stripes {
    0% {
        background-position-x: var(--bs-progress-height);
    }
}

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Quick gif with 2rem high progress bars:
2024-08-19 22-17-33 3

This can't be seen in the documentation, but here's the relevant page:

Related issues

Copy link
Member

@louismaximepiton louismaximepiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for your contribution.

The solution you provide is quite elegant in here. It seems that it was forgotten when we implemented the CSS variables. I'm fine adding it on my side. The only drawback I could see is that the animation is faster the more you increase the progress size. However, I think it works well for small values and it's better than what we have now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready to merge
Development

Successfully merging this pull request may close these issues.

2 participants