Skip to content

[Form][WCAG] Errors sign for people that do not see colors #26327

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

Closed
wants to merge 8 commits into from

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Feb 26, 2018

Q A
Branch? 3.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

According to my friend and WCAG2 expect Sandra:

The form errors is correctly encoded and works great. But visually they may be hard to see for people that do not see colors very well. Try to improve errors with an icon to make it more visual clear that an error has occurred.

screen shot 2018-02-26 at 17 42 01

@fabpot
Copy link
Member

fabpot commented Feb 27, 2018

The only downside is that there is no way to easily customize the chosen icon. Would it be possible to. do the same via CSS?

@Nyholm
Copy link
Member Author

Nyholm commented Feb 27, 2018

Bootstrap 4 does not have any icons included. They do have 8 base64 images in their CSS but none that we can use.
I do not like the idea do provide a "symfony-bootstrap4" css file.

A way to customize the icon would be to introduce a twig block and let the user to override it.

@javiereguiluz
Copy link
Member

Not sure if it's relevant, but in EasyAdmin we use a word (Error) translated into the user's language instead of an icon:

error-en

error-ru

In any case, no matter if we use an icon or a translated text, we should wrap it with <span> or something else so people can quickly hide it, change its styles, etc.

@ogizanagi
Copy link
Contributor

But that could be easily achieved on userland using CSS I guess. Bootstrap 4 does not showcase anything regarding this AFAIK, so if it's really a good practice recommended by the WCAG2, perhaps it should be fixed on bootstrap side rather than on our own by arbitrary choosing a way to make it more visual.

Otherwise, I do prefer the EasyAdmin way as shown by @javiereguiluz.

@Nyholm
Copy link
Member Author

Nyholm commented Feb 27, 2018

Yes, I do like that as well. Since we have that clear background and the word "error" it should be okey.

@nicolas-grekas
Copy link
Member

Status: needs work

@Nyholm
Copy link
Member Author

Nyholm commented Feb 28, 2018

I've added the "error badge":

screen shot 2018-02-28 at 18 38 35

I need some guidance with where to put the translation for key "error". I would like to put it in the TwigBridge because that's where we use it. As alternative one could put it in the validator component.

I would also like to use the "validator" domain.

Any suggestions?

@javiereguiluz
Copy link
Member

Another quick comment just for your consideration. In EasyAdmin, when there are multiple errors in a single field, to avoid displaying too many ERROR badges, we display a single ERRORS badge (in plural) and a <ul> of the error messages:

multiple-errors

But maybe this is too much attention to detail for Symfony core. Not sure.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Mar 1, 2018

the repeated "ERROR" label LGTM
but before merging, the composer.json of the Form component must be updated to conflict with symfony/twig-bridge <3.4.5|<4.0.5,>=4.0

@@ -244,7 +244,7 @@
<div class="{% if form is not rootform %}invalid-feedback d-block{% else %}alert alert-danger{% endif %}">
<ul class="list-unstyled mb-0">
{%- for error in errors -%}
<li>{{ error.message }}</li>
<li><span class="initialism form-error-icon badge badge-danger">{{ 'error'|trans }}</span> <span class="form-error-message">{{ error.message }}</span></li>
Copy link
Member

@nicolas-grekas nicolas-grekas Mar 1, 2018

Choose a reason for hiding this comment

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

just a raw idea: instead of "error", we put that "X" unicode cross,
then we add a translation table where this "X" maps to "ERROR" in english, same in a few other languages,
but if we don't have the translation for the word "error", the cross is displayed instead - as it is more universal than "error", isn't it?
makes sense?

@Nyholm
Copy link
Member Author

Nyholm commented Mar 1, 2018

I've added more translations. Fabbot is a false negative.

@nicolas-grekas
Copy link
Member

Thank you @Nyholm.

nicolas-grekas added a commit that referenced this pull request Mar 1, 2018
… (Nyholm)

This PR was squashed before being merged into the 3.4 branch (closes #26327).

Discussion
----------

[Form][WCAG] Errors sign for people that do not see colors

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

According to my friend and WCAG2 expect [Sandra](https://twitter.com/sandrability):

> The form errors is correctly encoded and works great. But visually they may be hard to see for people that do not see colors very well. Try to improve errors with an icon to make it more visual clear that an error has occurred.

![screen shot 2018-02-26 at 17 42 01](https://user-images.githubusercontent.com/1275206/36802282-c81357c6-1cb4-11e8-843c-4592e3d597f9.png)

Commits
-------

3f8cd05 [Form][WCAG] Errors sign for people that do not see colors
@Nyholm
Copy link
Member Author

Nyholm commented Mar 1, 2018

Great. Thank you

@Nyholm Nyholm deleted the 3-wcag-error branch March 1, 2018 10:24
This was referenced Mar 1, 2018
mweimerskirch added a commit to mweimerskirch/symfony that referenced this pull request Mar 30, 2018
fabpot pushed a commit to mweimerskirch/symfony that referenced this pull request Mar 31, 2018
fabpot added a commit that referenced this pull request Mar 31, 2018
…that do not see colors) (mweimerskirch)

This PR was submitted for the 3.4 branch but it was merged into the 2.7 branch instead (closes #26715).

Discussion
----------

Added LB translation for #26327 (Errors sign for people that do not see colors)

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | n/a
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26327
| License       | MIT

Commits
-------

c1fae9e Added LB translation for #26327 (Errors sign for people that do not see colors)
fabpot added a commit that referenced this pull request Apr 2, 2018
* 2.7:
  [HttpCache] Unlink tmp file on error
  Added LB translation for #26327 (Errors sign for people that do not see colors)
  [TwigBridge] Fix rendering of currency by MoneyType
  [HttpKernel] DumpDataCollector: do not flush when a dumper is provided
fabpot added a commit that referenced this pull request Apr 2, 2018
* 2.8:
  fixed deprecated messages in tests
  [HttpCache] Unlink tmp file on error
  Added LB translation for #26327 (Errors sign for people that do not see colors)
  [TwigBridge] Fix rendering of currency by MoneyType
  [HttpKernel] DumpDataCollector: do not flush when a dumper is provided
nicolas-grekas added a commit that referenced this pull request Apr 2, 2018
* 3.4: (24 commits)
  moved Twig runtime to proper class
  fixed deprecated messages in tests
  add PHP errors options to XML schema definition
  [HttpCache] Unlink tmp file on error
  Added LB translation for #26327 (Errors sign for people that do not see colors)
  [TwigBridge] Fix rendering of currency by MoneyType
  Import InvalidArgumentException in PdoAdapter
  [DI] Do not suggest writing an implementation when multiple exist
  [Intl] Update ICU data to 61.1
  Use 3rd person verb form in command description
  [Validator] Add Japanese translation
  Support phpdbg SAPI in Debug::enable()
  [HttpKernel] DumpDataCollector: do not flush when a dumper is provided
  [DI] Fix hardcoded cache dir for warmups
  [Routing] fix tests
  [Routing] Fixed the importing of files using glob patterns that match multiple resources
  [Ldap] cast to string when checking empty passwords
  [Validator] sync validator translation id
  [WebProfilerBundle] use the router to resolve file links
  no type errors with invalid submitted data types
  ...
nicolas-grekas added a commit that referenced this pull request Apr 2, 2018
* 4.0: (24 commits)
  moved Twig runtime to proper class
  fixed deprecated messages in tests
  add PHP errors options to XML schema definition
  [HttpCache] Unlink tmp file on error
  Added LB translation for #26327 (Errors sign for people that do not see colors)
  [TwigBridge] Fix rendering of currency by MoneyType
  Import InvalidArgumentException in PdoAdapter
  [DI] Do not suggest writing an implementation when multiple exist
  [Intl] Update ICU data to 61.1
  Use 3rd person verb form in command description
  [Validator] Add Japanese translation
  Support phpdbg SAPI in Debug::enable()
  [HttpKernel] DumpDataCollector: do not flush when a dumper is provided
  [DI] Fix hardcoded cache dir for warmups
  [Routing] fix tests
  [Routing] Fixed the importing of files using glob patterns that match multiple resources
  [Ldap] cast to string when checking empty passwords
  [Validator] sync validator translation id
  [WebProfilerBundle] use the router to resolve file links
  no type errors with invalid submitted data types
  ...
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.

6 participants