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

Docs: rewrite/reorganise carousel docs page #37354

Merged
merged 34 commits into from
Nov 29, 2022
Merged

Conversation

patrickhlauke
Copy link
Member

@patrickhlauke patrickhlauke commented Oct 22, 2022

Description

Make the carousel docs page more sensible/logically structured:

  • start with static/non-autoplaying examples
  • explicitly mention that carousels currently need to be manually initialized
  • split out and explain autoplaying data-bs-ride="carousel" and the weird "autoplay after first interaction" data-bs-ride="true" behaviour, as well as the fact that when animating, these carousels pause on hover/focus
  • various minor language/wording tweaks

In addition, this now explicitly initialises all carousels, so their touch behaviour will work right after page load (rather than only after the first click on a prev/next button).

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

Related issues

Closes #37295

* start with static/non-autoplaying examples
* explicitly mention that carousels currently need to be manually initialized
* split out and explain autoplaying and the weird "autoplay after first interaction" behaviour, as well as the pause on hover/focus
@patrickhlauke patrickhlauke force-pushed the patrickhlauke-docs-carousel-rewrite branch from 1ea8e4a to ef22a31 Compare October 22, 2022 00:04
@patrickhlauke patrickhlauke marked this pull request as ready for review October 22, 2022 00:35
@patrickhlauke patrickhlauke requested a review from a team as a code owner October 22, 2022 00:35
@patrickhlauke patrickhlauke force-pushed the patrickhlauke-docs-carousel-rewrite branch from 76cbe37 to 25c51fa Compare October 22, 2022 00:48
@patrickhlauke patrickhlauke force-pushed the patrickhlauke-docs-carousel-rewrite branch 2 times, most recently from 15d0660 to a0c5e73 Compare October 22, 2022 08:53
move the sentence about not double-initialising autoplaying carousels to the callout right at the top
instead of talking about `data-bs...` attributes, talk about the "option" instead, as authors may be setting these not via data attributes, but at instatiation time with options in the constructor
remove the incorrect statement about pausing when keyboard focus is in the carousel
Copy link
Member

@GeoSot GeoSot left a comment

Choose a reason for hiding this comment

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

LGTM

site/content/docs/5.2/components/carousel.md Outdated Show resolved Hide resolved
site/content/docs/5.2/components/carousel.md Show resolved Hide resolved
* start with static/non-autoplaying examples
* explicitly mention that carousels currently need to be manually initialized
* split out and explain autoplaying and the weird "autoplay after first interaction" behaviour, as well as the pause on hover/focus
move the sentence about not double-initialising autoplaying carousels to the callout right at the top
instead of talking about `data-bs...` attributes, talk about the "option" instead, as authors may be setting these not via data attributes, but at instatiation time with options in the constructor
remove the incorrect statement about pausing when keyboard focus is in the carousel
@GeoSot GeoSot force-pushed the patrickhlauke-docs-carousel-rewrite branch from 8878334 to ee55225 Compare October 23, 2022 10:12
@mdo mdo self-assigned this Oct 31, 2022
louismaximepiton added a commit to louismaximepiton/bootstrap that referenced this pull request Nov 9, 2022
site/assets/js/snippets.js Outdated Show resolved Hide resolved
// Instantiate all non-autoplaying carousels in a docs or StackBlitz page
document.querySelectorAll('.carousel:not([data-bs-ride="carousel"])')
.forEach(carousel => {
bootstrap.getOrCreateInstance.Carousel(carousel)
Copy link
Member

@julien-deramond julien-deramond Nov 28, 2022

Choose a reason for hiding this comment

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

When loading https://deploy-preview-37354--twbs-bootstrap.netlify.app/docs/5.2/components/carousel/, we have this in the console:

Uncaught TypeError: bootstrap.getOrCreateInstance is undefined
    <anonymous> https://deploy-preview-37354--twbs-bootstrap.netlify.app/docs/5.2/assets/js/docs.min.js:6
    <anonymous> https://deploy-preview-37354--twbs-bootstrap.netlify.app/docs/5.2/assets/js/docs.min.js:6
    <anonymous> https://deploy-preview-37354--twbs-bootstrap.netlify.app/docs/5.2/assets/js/docs.min.js:6

Isn't it bootstrap.Carousel.getOrCreateInstance(carousel) here?

Tried a fix via 7fd7a3b. Let you check that. Please revert it if it causes any issue 🙏

Moreover, if I have well understood the discussions in the corresponding issue, this PR also tackles #37546 (newly created). We could mark it as duplicate and close it.

@mdo mdo merged commit 0444d2c into main Nov 29, 2022
@mdo mdo deleted the patrickhlauke-docs-carousel-rewrite branch November 29, 2022 07:20
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 this pull request may close these issues.

Carousel: No listeners for mobile carousels with data-bs-ride=boolean
4 participants