-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Carousel: Adding multiple items in one frame #37272
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
base: main
Are you sure you want to change the base?
Carousel: Adding multiple items in one frame #37272
Conversation
2b119cb to
5b6fceb
Compare
js/src/carousel.js
Outdated
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.
Do you think that those 3 functions should be public ? Or maybe checkItemsBehavior only ?
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.
For sure not public ;)
|
personally not a massive fan of grafting this behaviour on top of the current carousel, as it's a bit clunky already. wondering if in the long run we don't want to change this to a more general purpose "content scroller" type widget. having said that, this seems to be working ok. even controlling the carousel via JavaScript (e.g. using i would suggest, for the demo in the docs, not to have it also auto-cycle, as i'd say it makes it more confusing. related, I've been working on a reorganisation/rewrite of the page here #37354 |
e6a68d8 to
b88acaa
Compare
|
@twbs/team any other opinions on this? Should we continue on this idea or not? Just to be honest, given that there are already two nice carousel implementations, I would leave it as simple as it is possible Note: in case we decide to proceed I am full in to help |
|
Note that the description of what this does is not quite accurate. rather than "have multiple items in one slide", this "displays multiple slides at the same time" or similar. And, as suggested, I'd really avoid having |
|
I totally understand your concerns about this feature, but is there any update on this ? |
|
I gave some time to test the implementation and tried some alternatives. I would prefer a more clean way to achieve the multiple items (I tried some things locally, but my css skills didn't help a lot) In case you can think of a more straight way to achieve it, the breakpoints, could be a configuration array, combined of pixels and number of items |
|
For what is worth, as much as I believe there are better alternatives out there, it's one of the features we are really missing for so long. Maybe @mdo can help out with the CSS stuff, but landing such a feature would make a lot of people happy, including myself :) I had to resort on custom hacked solutions to get this working in the past, and it did work, but official support for this properly would be a huge feature. |
js/src/carousel.js
Outdated
| } | ||
|
|
||
| _checkItemsBehavior() { | ||
| if (window.innerWidth >= 768) { |
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.
Shouldn't this be configurable?
|
Can't wait for this! Only thing that would be useful is configurable quantity of item depending on devices resolution (like grid columns), for example:
|
|
Hi there, tried some things on this last week, here are my concerns about a different implementation:
On another topic, |
I think for better consistency, configuration should use JSON values like explained in Carousel DOCS, example: I would also change the name
In this situation it should only shows 2 items because they are in range (3) - the fact that an item is missing is a fault of developer |
|
As a personal preference, I would suggest keeping the code as much as agnostic can be, with less complexity, as the maintenance, can be a real pain
Let let the dev decide the breakpoints, ex: bs-items=2 or bs-items=2,768|3,1200 etc (pick a pattern it suits and can be adapted from other components too on v6)
In this case, you should reduce the items programmatically, throw an exception or copy them. Again I would pick the simplest, to reduce items. |
|
Any chance to implement this feature in 5.3 ? |
|
I don't think so since the 5.3 is mostly for the dark mode of Bootstrap. Maybe in the next version if I have time to work on it ! |
|
Tried a new version of this, there's still some code generation but way lesser than before. Tweaked a lot of things and didn't manage many others for now. Changed the way to manage the carousel items, indicators etc so it might be a bit broken for now. Just wanted to know if something like that would be better ? The only other option I can think about is using flexbox (as right now) and force the order property for each child but might be hard to handle the keyboard focus so I'm not that fine using this. Do you have any feedback on this ? |
Description
Strongly based on XhmikosR ideas in #28210.
Motivation & Context
Seems to be an asked feature.
Type of changes
Checklist
npm run lint)Live previews
Related issues
Fixes #29130
Fixes #27652
Still todo
Add tests
Better doc
May want to add a focus handle on the first child only (and
tabindex=-1on the remaining) for accessibility purpose (avoid dupes on screen readers)