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

Fix images on auto in download app example page #2261

Merged

Conversation

MewenLeHo
Copy link
Contributor

@MewenLeHo MewenLeHo commented Sep 21, 2023

Related issues

Closes #2243

Description

Following the issue explained in #2243:

(1) I made some tests and it appears that the bug described in the issue only happens on a specific occasion: when your computer is set to 'Light mode' and you use the 'Auto color mode' on the page.

(2) If your your computer is set to 'Dark mode' and you use the 'Auto color mode' on the page the it works perfectly fine.

=> I made a fix in CSS for (1)
=> I also made an additional piece of code (see comment) for (2) as defensive CSS.

Motivation & Context

Prevent having both light and dark images in 'Auto color mode'.

Types of change

  • Bug fix (non-breaking which fixes an issue)

Live previews

Checklist

Contribution

Accessibility

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

Design

  • (na) My change respects the design guidelines defined in Orange Design System
  • My change is compatible with a 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 well displayed in Storybook
  • (na)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
  • (na) Design review
  • (na) A11y review

After the merge

@MewenLeHo MewenLeHo added v5 fix color mode Temporary label to highlight color mode issues labels Sep 21, 2023
@MewenLeHo MewenLeHo self-assigned this Sep 21, 2023
@netlify
Copy link

netlify bot commented Sep 21, 2023

Deploy Preview for boosted ready!

Name Link
🔨 Latest commit 02b2b67
🔍 Latest deploy log https://app.netlify.com/sites/boosted/deploys/65111cc119e11e0008e4abe5
😎 Deploy Preview https://deploy-preview-2261--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 configuration.

@MewenLeHo MewenLeHo changed the title Fix [] Fix images on auto in download app example page Sep 21, 2023
@MewenLeHo MewenLeHo changed the title [] Fix images on auto in download app example page Fix images on auto in download app example page Sep 21, 2023
@MewenLeHo MewenLeHo marked this pull request as ready for review September 21, 2023 07:21
@julien-deramond julien-deramond mentioned this pull request Sep 22, 2023
Copy link
Member

@louismaximepiton louismaximepiton left a comment

Choose a reason for hiding this comment

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

I'm fine landing it as a patch for a bug for v5.3.3 which will arrive soon. I think we don't need any defensive CSS on this.

However, maybe we can fix the color-mode javascript on Bootstrap directly because right now we have:

color-mode on Bootstrap color-mode on device Result in HTML
dark * data-bs-theme="dark"
light * data-bs-theme="light"
auto dark data-bs-theme="dark"
auto light data-bs-theme="auto"

For instance, I was able to reproduce the behavior you patch here by patching color-mode.js.

Here is the diff:

  const setTheme = theme => {
- if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
-   document.documentElement.setAttribute('data-bs-theme', 'dark')
+ if (theme === 'auto') {
+   document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
  } else {

@MewenLeHo
Copy link
Contributor Author

MewenLeHo commented Sep 22, 2023

Defensive CSS was removed as requested.

A PR has been opened on Bootstrap's side to update color-form-js.

The plan here is to keep the CSS fix presented in the current PR to allow the example page to work correctly.

Then:
->if the js fix is not ok for Bootsrap: keep our CSS fix.
->if the js fix is ok for Bootsrap: keep our CSS fix until the js fix is merged in Boosted repository then remove if since it will no longer be needed.

@julien-deramond julien-deramond self-requested a review September 25, 2023 05:38
Copy link
Contributor

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

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

LGTM, adding something in #2223 to track it

@julien-deramond julien-deramond merged commit 720fe45 into main Sep 25, 2023
13 checks passed
@julien-deramond julien-deramond deleted the main-mlh-fix-images-auto-download-app-example-page branch September 25, 2023 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color mode Temporary label to highlight color mode issues examples fix v5
Projects
Development

Successfully merging this pull request may close these issues.

[Download app example page] Images on auto
3 participants