-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Conversation
* 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
1ea8e4a
to
ef22a31
Compare
…ncy with last code block on the page
…nested and accessibility paragraph
76cbe37
to
25c51fa
Compare
15d0660
to
a0c5e73
Compare
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
a0c5e73
to
8878334
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* 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
…ncy with last code block on the page
…nested and accessibility paragraph
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
8878334
to
ee55225
Compare
…com/twbs/bootstrap into patrickhlauke-docs-carousel-rewrite
Co-authored-by: GeoSot <geo.sotis@gmail.com>
site/assets/js/snippets.js
Outdated
// 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) |
There was a problem hiding this comment.
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.
Description
Make the carousel docs page more sensible/logically structured:
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/focusIn 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
Checklist
npm run lint
)Live previews
Related issues
Closes #37295