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

feat: Improve photo gallery accessibility + internationalization #5366

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

g123k
Copy link
Collaborator

@g123k g123k commented Jun 13, 2024

HI everyone,

Here is the current layout for the gallery:
Screenshot 2024-06-13 at 10 16 47

There are three issues:

  • Text is poorly readable (and thus accessible)
  • No accessibility node
  • The date format is not translated

I've fixed all of them + added the icon from the POC:

Screenshot 2024-06-13 at 12 13 29

@g123k g123k requested a review from a team as a code owner June 13, 2024 08:21
@codecov-commenter
Copy link

codecov-commenter commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 57 lines in your changes missing coverage. Please review.

Project coverage is 7.43%. Comparing base (4d9c7fc) to head (a45d398).
Report is 185 commits behind head on develop.

Files Patch % Lines
...ooth_app/lib/pages/image/product_image_widget.dart 0.00% 46 Missing ⚠️
.../pages/image/product_image_gallery_other_view.dart 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5366      +/-   ##
==========================================
- Coverage     9.54%   7.43%   -2.12%     
==========================================
  Files          325     380      +55     
  Lines        16411   19483    +3072     
==========================================
- Hits          1567    1448     -119     
- Misses       14844   18035    +3191     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

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

Hi @g123k!
It's no obvious in your UI if the date refers to the top or the bottom image.
And I have doubts about letting translators decide technical date formats and I recommend DateFormat.yMd.
Beyond those remarks, it's an improvement, thanks!
Ping @jusdekiwi who created #5128 (#5144).

packages/smooth_app/lib/l10n/app_en.arb Outdated Show resolved Hide resolved
@g123k
Copy link
Collaborator Author

g123k commented Jun 13, 2024

Good point for the date placement.
What about switching to a card-based layout?

Screenshot 2024-06-13 at 11 48 42

@monsieurtanuki
Copy link
Contributor

What about switching to a card-based layout?

Cards would make sense 👍

@g123k
Copy link
Collaborator Author

g123k commented Jun 13, 2024

I've implemented the change to a card-based layout.

  • the color of the card is the main color of the photo.
Screenshot 2024-06-13 at 12 13 29

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

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

Hi @g123k!
That's almost perfect, but I would really simplify it and dismiss your palette related code, cf. my comments.

final DateFormat dateFormat =
DateFormat.yMd(ProductQuery.getLanguage().offTag);

darkBackground = darkBackground ?? true;
Copy link
Contributor

Choose a reason for hiding this comment

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

If the default is true, it would be much simpler to say that the default is true, wouldn't it?

Something like bool darkBackground = true;. Et voilà.

Same for backgroundColor.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here we can say it's a balance between optimization VS code clarity.
By doing bool darkBackground = true , we force all items in the grid to have a value in the memory.
Here, until the palette is computed, it's memory free.

_loadImagePalette();
}

Future<void> _loadImagePalette() async {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe in your palette tap dancing, for several UI/UX reasons:

  • dark mode means dark mode
  • let's assume that the user wants to have widgets with the same color when they do the same thing on the same page, and not a "random" meaningless patchwork of dark and light
  • you're somehow downloading the full image twice - even though I guess there's cache involved behind
  • the colors may change after loading is complete

Copy link
Member

@teolemon teolemon left a comment

Choose a reason for hiding this comment

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

It's better than the current situation, approved.

@teolemon teolemon merged commit 64d38f1 into openfoodfacts:develop Jun 18, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants