Add a "skeletons" component#31859
Conversation
mdo
left a comment
There was a problem hiding this comment.
This is awesome! Just a few questions and stuff in a quick review :D.
|
to make any kind of sense to assistive tech users, at the very least these will need to have some indication like |
|
@patrickhlauke I've added the |
9c3c85b to
fba3a07
Compare
fba3a07 to
f33464d
Compare
ffoodd
left a comment
There was a problem hiding this comment.
Apart from my CSS-part comments, did you ever think of using SVG for this? Using some <rect>s to lay up the pattern would be quite easy too, and it'd be easier to convey alternate text.
Not quite sure about this, but that's how I handled it years ago. I guess using raw markup may be easier to use but still want to consider alternate ways :)
Nice feature idea and overall work though, thanks!
|
We at BootstrapVue recently introduced sketeton components. It would be awesome to have official support for all of these components in Bootstrap v5. |
|
The |
@jackmu95 I didn't know of the existence of this (component)! Also, I was plaing with IMO I'd say those two effects "glow" and "wave" are a must for the Bootstrap version. 😋 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bf58e52 to
061eb51
Compare
This comment has been minimized.
This comment has been minimized.
061eb51 to
77f6625
Compare
|
Just to tell you: |
|
The markup can be simplified quite a bit if we're using |
|
I may have some free time this weekend. Let me know if I can help with anything. |
|
i should be able to spend some time this weekend on this as well, yes |
|
is netlify updating its preview or is it just not running due to bundlewatch failure? |
|
assuming https://deploy-preview-31859--twbs-bootstrap.netlify.app/docs/5.0/components/placeholders/ is still the latest version:
I'd say two things at least should happen:
|
|
@jaumesala Hey there! It's been awhile, but we're finally shipping v5.0.0 and are ready to look at our next set of features for v5.1.0. Would you be willing to jump back in here and help us ship this? If not we can try to tackle ourselves :). Thanks! |
|
Hey @mdo! Yeah, glad to help you guys! I've reread the last comments and commited some changes regarding "a11y" and SCSS. I've also cleaned up some examples in the documentation. Let me know what you think. Btw, It looks like Bundlewatch is still complainging about the size. |
|
circling back to this, as note also that any focusable elements need to be explicitly made non-focusable with |
|
Ok @patrickhlauke! Just to be sure I understand your comment. Using the example as a reference, it is enough to add <div class="card" aria-busy="true" style="width: 18rem;">
<img aria-hidden="true" src="..." class="card-img-top" alt="...">
<div aria-hidden="true" class="card-body">
<h5 class="card-title placeholder-glow">
<span class="placeholder col-6"></span>

</h5>
<p class="card-text placeholder-glow">
<span class="placeholder col-7"></span>
<span class="placeholder col-4"></span>
<span class="placeholder col-4"></span>
<span class="placeholder col-6"></span>
<span class="placeholder col-8"></span>
</p>
<a href="#" tabindex="-1" class="btn btn-primary disabled placeholder col-6">
<!-- needed to give the element some height -->
</a>
</div>
</div> |
|
i think currently, seeing that AT with one exception don't actually do anything useful/announce anything to users, we can probably completely forego in the case of the card, just hiding the entire card with <div class="card" aria-hidden="true" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title placeholder-glow">
<span class="placeholder col-6"></span>

</h5>
<p class="card-text placeholder-glow">
<span class="placeholder col-7"></span>
<span class="placeholder col-4"></span>
<span class="placeholder col-4"></span>
<span class="placeholder col-6"></span>
<span class="placeholder col-8"></span>
</p>
<a href="#" tabindex="-1" class="btn btn-primary disabled placeholder col-6">
<!-- needed to give the element some height -->
</a>
</div>
</div>it gets a bit trickier/nuanced if it's a very specific element with a role and accessible name that is currently being updated ... for instance, a link on its own that is being updated seems to be announced as "busy" - for instance, the example given of the busy link is indeed announced as "busy, link" by Chrome/NVDA. but i think that's more an edge case. i'd be ok with the whole link just being hidden. long story short: just hiding the element that is set as a skeleton is probably sufficient at this stage. It gets more case-specific depending how authors will actually use the placeholder styles, how they plan to update things, etc. Might be worth just focusing on the styling here, showing a basic example with just |
|
Does anybody have any ideas how we could skip the |
|
I've updated the code with @patrickhlauke recommendations and rewritten the callout information regarding the loading implementation. Take a look, it might need better words. 😋 |
35bda77 to
86db844
Compare
|
Pushed some changes and squashed everything into a single commit here. The main change was to add some pseudo-class styles for |
Co-Authored-By: XhmikosR <xhmikosr@gmail.com> Co-Authored-By: Jaume Sala <jaumesala@gmail.com>
86db844 to
50fcd54
Compare
|
Pinging @patrickhlauke for another look at a11y and @ffoodd for the CSS changes :) |
Introduction
Nowadays, webapps use different techniques to improve the UX of the user when some data needs to be loaded. One of those trending techniques is the use of css "skeletons". No matter what javascript tool we use, we should facilitate and encourage developers to use them. Now that the framework is evolving and other components like the
spinnerhas been added. I've thought on give a shot and explore theskeletonsoption.How it works
Skeletons are composed of
.skeleton-lines. Each of them needs one or more.skeleton-dashes.By default all
.skeleton-dashes together will take the full with of the.skeleton-line. Still, you can customize them with custom css widths or even using the utility classes.The way it works is using a hidden empty space to preserve the size of the parent HTML element. This way we can mimic the original element proportion.
For more information on how it works, check the documentation.
Waiting for feedback.
Fixes #31665
Preview: https://deploy-preview-31859--twbs-bootstrap.netlify.app/docs/5.0/components/placeholders/
TODO:
rangein the colors docs?