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

Cards: Use svg instead of text inside the placeholder image #1886

Merged
merged 7 commits into from
Mar 16, 2023

Conversation

louismaximepiton
Copy link
Member

@louismaximepiton louismaximepiton commented Mar 9, 2023

Note: Please transform - [ ] into - (NA) in the description when things are not applicable

Related issues

Related to #1677.

Description

Use a svg instead of text.

Motivation & Context

Better a11y + might be better detected inside pa11y-ci.
Closer to design.

Types of change

  • Refactoring (non-breaking change)

Live previews

Checklist

Contribution

Accessibility

  • My change follows accessibility good practices; I have at least run axe

Design

  • My change respects the design guidelines defined in Orange Design System
  • My change is compatible with responsive display

Development

  • My change follows the developer guide
  • (NA) I have added JavaScript unit tests to cover my changes
  • (NA) I have added SCSS unit tests to cover my changes

Documentation

  • (NA) My change introduces changes to the documentation and/or I have updated the documentation accordingly

Checklist (for Core Team only)

  • (NA) My change introduces changes to the migration guide
  • (NA) My new component is added in Storybook
  • My new component is compatible with RTL
  • Manually run BrowserStack tests
  • Manually test browser compatibility with BrowserStack (Chrome >= 60, Firefox >= 60 (+ ESR), Edge, Safari >= 12, iOS Safari, Chrome & Firefox on Android)
  • Code review
  • Design review
  • A11y review

After the merge

@netlify
Copy link

netlify bot commented Mar 9, 2023

Deploy Preview for boosted ready!

Name Link
🔨 Latest commit 262831c
🔍 Latest deploy log https://app.netlify.com/sites/boosted/deploys/64131dc2c588200008a006b5
😎 Deploy Preview https://deploy-preview-1886--boosted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -22,9 +22,11 @@
{{- $rtl := .Get "rtl" | default false -}}

<div class="card{{ if eq $borders false }} border-0{{ end }}{{ if and $borders (eq $background "dark") }} border-dark{{ end }}">
<svg class="bd-placeholder-img card-img-top" width="100%" height="162" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="{{ if $rtl }}تعليق على الصورة{{ else }}Image cap{{ end }}" preserveAspectRatio="xMidYMid slice" focusable="false">
<svg class="bd-placeholder-img card-img-top" width="100%" height="169" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="{{ if $rtl }}تعليق على الصورة{{ else }}Image cap{{ end }}" preserveAspectRatio="xMidYMid slice" focusable="false">
Copy link
Contributor

@MewenLeHo MewenLeHo Mar 13, 2023

Choose a reason for hiding this comment

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

Currently wondering if Image cap is a good value for an aria-label attribute?
It's outside the frame of the current PR so we may discuss it in a distinct issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems to be on Bootstrap Side so yes, let's tackle it there directly!

Copy link
Contributor

@MewenLeHo MewenLeHo left a comment

Choose a reason for hiding this comment

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

aria-hidden="true" focusable="false" is good for a non-informative svg so ok from an accessibility point of view.

I am just wondering if we need to do the same modifications elsewhere?

@@ -20,7 +20,7 @@ Below is an example of a basic card with mixed content and a fixed width. Cards

{{< example >}}
<div class="card" style="width: 18rem;">
{{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
{{< placeholder width="100%" height="180" class="card-img-top" text="icon" >}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Was the transition from 'Image cap' to 'icon' validated by our a11y expert or do we need to ask him for a review?
Shouldn't it be tackled on Bootstrap's side? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the right label for upcoming a11y review and yeah it might be proposed on their side as well.

MewenLeHo

This comment was marked as outdated.

Copy link
Contributor

@MewenLeHo MewenLeHo left a comment

Choose a reason for hiding this comment

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

Ok for me, just one remaining question to check with a11y experts in our side and/or Bootstrap's side.

@Aniort
Copy link
Contributor

Aniort commented Mar 15, 2023

as discuss with @louismaximepiton, there's some improvement that has to be made in another PR, so ok on this one

site/content/docs/5.3/components/card.md Show resolved Hide resolved
<rect width="100%" height="100%" fill="{{ (index $.Site.Data.grays 3).hex }}"/>
<text x="50%" y="50%" fill="{{ (index $.Site.Data.grays 5).hex }}" dy=".3em">{{ if $rtl }}تعليق على الصورة{{ else }}Image cap{{ end }}</text>
<svg x="30%" y="30%" width="40%" height="40%" viewBox="0 0 24 24" fill="#00000014" aria-hidden="true" focusable="false">
Copy link
Member

Choose a reason for hiding this comment

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

We don't have a corresponding value in our $.Site.Data.grays list?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I don't think so. I chose to have a kind of watermark with opacity since we have some use cases using colored backgrounds and the grey was pretty ugly to use with. Tell me what you think the best between:
image
image

Copy link
Member

Choose a reason for hiding this comment

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

None 😄 Should probably be a dark gray but nevermind, it's not that related to the PR. Edge case.

site/layouts/shortcodes/placeholder.html Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Mar 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@julien-deramond julien-deramond merged commit 238a27f into main Mar 16, 2023
@julien-deramond julien-deramond deleted the main-lmp-card-use-svg-placeholder branch March 16, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants