It has become apparent from the work in #1493324: Inline form errors for accessibility and UX that Bartik does not have it's own form item error styling, it only uses what Core gives it.
 

 
The current styles do a basic job but it would be great to improve them.
For example, errors show as a 2px red border on all form items. But when you focus on the element the focus colour is blue and the text prints in black. You would think at least the focus would be red.
 

 
Looking at Seven it has really nice clear error styles on form elements that consider usability and accessibility for the user.
Error background colours, text colours and focus styles have been added.

The styles of the form elements in Seven have been even more improved within #1493324: Inline form errors for accessibility and UX.
 

 

How to manually test this issue

Pull 8.2.x HEAD and apply the latest patch
Install Drupal
Log in as user 1
Download and install dmsmidt's Errorstyle module from GitHub https://github.com/dmsmidt/errorstyle (forked from vijaycs85's original)
Choose your preferred theme from /admin/appearance
Go to /error-style/form
Submit the form
See all the errors.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bojhan’s picture

Status: Postponed » Active
emma.maria’s picture

The screenshots will now be different after #1493324: Inline form errors for accessibility and UX was committed. I will update and tag with #Novice.

david.hughes’s picture

Issue tags: +Barcelona2015

At Barcelona Sprint with mentor Gregg Marshall

david.hughes’s picture

FileSize
44.55 KB

I've taken the styles used for the error focus by the Seven theme and added them to the Bartik theme to achieve a similar box-shadow. I've noticed this has some minor issues on the user edit form, for example. Patch to follow.

david.hughes’s picture

david.hughes’s picture

ckaotik’s picture

Based on David's patch this one now applies the background to all error input fields and adds the red glow only to focussed errored fields.

Unfocussed error field
Focussed errored field

david.hughes’s picture

FileSize
1.93 KB

I'll take a look at this. For convenience, here's the module I'm using which has a simple form to test this patch (and any that may follow).

david.hughes’s picture

FileSize
2 KB

I've checked your patch on OSX Yosemite with Chrome and Firefox (both latest versions, 25th Sept). Looks good. Attaching latest version of the module which has a select field & textarea.

Edit: For reference, the form this module creates lives at /example_form

greggmarshall’s picture

helping our table as the mentor.

arled’s picture

FileSize
4.96 KB

Added radio buttons to the example form. DrupalCon Barcelona 2015.

vimokkhadipa’s picture

Tried patch using sample module.

After clearing cache works! tested using chromium versión 45 on linux mint debian 2

arled’s picture

Status: Active » Reviewed & tested by the community

Applied and reviewed patch #7 during DrupalCon Barcelona 2015.
Browsers covered:
- Chrome
- Safari
- Firefox

Mirroar’s picture

I also took a look at this in IE 11. Looks good to me, without the patch there is actually no focus style for fields with errors, so this is definitely an accessibility improvement. Much better with the patch in #7.

RTBC+1 from Barcelona :)

david.hughes’s picture

Tested #7 in IE9, think this is good to go!

david.hughes’s picture

Having got this far, I'm wondering if this is something we should move back into the Classy theme instead? This would improve accessibility for D8 all around for any theme based off either Bartik, Seven or Classy rather than just the first two.

Working on a patch for consideration.

david.hughes’s picture

This patch moves the CSS into the Classy so that all themes using it as a parent will inherit this more accessible styling. Attached screenshots of how this looks on Chrome (missed checking the focus state in these screenshots so this will need testing).

emma.maria’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs usability review

Thanks for all of the work on this. I'm setting this back to 'Needs Review' whilst I and the usability maintainers check over the solutions above.

emma.maria’s picture

Also @david.hughes and @ckaotik, can you please create interdiff files along with patches to help us see the changes you individually have added to the patches you post. It makes reviews a lot easier and clearer. Thanks!

Documentation for creating an interdiff — https://www.drupal.org/documentation/git/interdiff.

david.hughes’s picture

FileSize
1.68 KB

Thanks Emma, I've created interdiffs for @ckaotik's patch in #7 (compared with my patch in #6 as well as one for my new patch in #17 which moves these changes into Classy (compared to #7).

david.hughes’s picture

FileSize
773 bytes

Missed diff between #6 and #7

Bojhan’s picture

Issue tags: -Needs usability review

Looks OK to me.

emma.maria’s picture

Version: 8.0.x-dev » 8.2.x-dev
emma.maria’s picture

I have added how to manually test this issue using the same method that #1493324: Inline form errors for accessibility and UX used.

It provided a module that provides every form element.

Hopefully this still works with Drupal 8.2.x!

Also we need to review the patch in comment #7!!!
We cannot make changes to the Classy theme post-launch of Drupal 8.

SidneyGijzen’s picture

Assigned: Unassigned » SidneyGijzen

I will be reviewing this in the coming days as part of my core mentoring program.

SidneyGijzen’s picture

This is a great idea. Thank you for the work already done in this issue!

I followed the instructions in the issue summary, and was able to install the 'error style test module' in the latest Drupal dev (8.2.x HEAD).

I tested the patch in comment #7, and it still applies cleanly.

Compared to the same form in Seven, my findings are:

  1. Seven uses a red font color in error styles while Bartik uses a black color. I personally favor the (current) black color, because that gives a user the impression that what he/she is typing isn't wrong (but more that the field needs his/her attention).
  2. Border width is thicker in Bartik: 2px (inherited property from Classy theme) vs 1px in Seven. Do we follow Seven or Classy in this?
  3. Error in 'Range' form type was only highlighted in error colors in Google Chrome when focused. Should we amend that in Bartik or in Classy?

Tested in browsers:

  1. Google Chrome 50 (Linux, Windows 10 & OS X El Capitan)
  2. Firefox 46 (Linux)
SidneyGijzen’s picture

Assigned: SidneyGijzen » Unassigned

Unassigning myself as I'm not working on a patch at the moment.

emma.maria’s picture

Thanks @MF82 your findings are super useful :-)

I'm going to take a look at these things and add some screenshots and possible actions for further additions to the work so far.

SidneyGijzen’s picture

Thanks @emma.maria for your feedback. Let me know if I can help you with anything.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

John Cook’s picture

Status: Needs review » Needs work

Testing on 9.4.0-dev, the patch no longer applies. Also, the changes need to be replicated in more locations (eg core/themes/bartik/css/classy/components/form.css).

It looks like the original testing was done on Chrome. Since then, Chrome has changed it's default focus styling; it is now a solid blue outline. Because the browser default has changed, this now makes a disconnect between the element with and without errors. To properly unify this, there will need to be a default focus style for all form elements, with an override for the elements with an error.

There will need to be tests done on other browsers as they all have different default focus styles, and they will all need to be check for consistency between the standard and error focus states. With Safari, Firefox, and Chrome, they all use a "blue" (the shade is different) outline as an indicator. Safari and Firefox show this outside the border, but Chrome overlaps it (hiding the border).

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

pameeela’s picture

Project: Drupal core » Bartik
Version: 10.1.x-dev » 1.0.2
Component: Bartik theme » Look and Feel
FileSize
64.06 KB
64.2 KB

Keeping this with Bartik because it is handled properly in Olivero. But it is still the case in Bartik that the focus state on an error has the blue outline.

No focus:

Focus: