Problem/Motivation

The CKEditor toolbar configuration UI (seen at e.g. admin/config/content/formats/manage/full_html is very hard for sighted keyboard-only users to use. The available buttons CAN currently be moved in and out of the active toolbar, but keyboard focus is not indicated to the user, which makes it practicallly impossible to know which button you are dealing with.

This issue is part of our goal of meeting WCAG 2.0 level AA, specifically Success Criterion 2.4.7. Focus Visible.

This is a follow-up to #1872206: Improve CKEditor toolbar configuration accessibility. Accessibility of toolbar configuration for screen reader users was previously addressed there.

Before:
Buttons with no visible focus
After (Well BarisW's first stab):
Button with visible focus

Proposed resolution

Add some Clear keyboard focus styles to the CKEditor toolbar configuration UI.

The scope of this issue is specifically about the experience of sighted keyboard users. It does not propose to change the screen reader experience.

Remaining tasks

  • Decide how to style the keyboard focus. Should not use colour alone.
  • Write CSS. Ensure it works in Seven theme (and Bartik?)

User interface changes

Adds keyboard focus styles for the CKEditor "Toolbar Configuration". Exact styles not yet decided. The design impact aims to be minimal, by only providing a focus style specific to the CKEditor admin UI.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andrewmacpherson created an issue. See original summary.

BarisW’s picture

Here's a first stab. I fiddled around with outlines and other styles, but eventually thought to apply the same yellow color that's used in the tabledrag interface.

Color indication for the ckeditor toolbar

BarisW’s picture

Status: Active » Needs review
FileSize
922 bytes
Wim Leers’s picture

Category: Bug report » Task

Interesting issue! Thanks for starting this.

Initial thoughts/questions:

  1. I've never found this to be unclear in Safari or Chrome on OS X: those browsers on that operating system seem to have very clear focus styles already. So: does this problem only exist for other browsers or operating systems?
  2. If we do this, shouldn't apply these styles/this pattern everywhere?
BarisW’s picture

Hi Wim, I'm using Chrome. The problem is that the default focus is disabled on links.

a:focus {
  outline: 0;
}

The button groups work fine (since they are divs with a tabindex attribute. But the buttons itself are a's so we need to overrule the default link focus styling.
Here's a screen recording. You can see that I move the button groups first (works fine) and then move the buttons within a group (it isn't clear which button is used).

andrewmacpherson’s picture

Likewise, same experience in firefox. I can see a focus around the active button group, but not individual buttons. We've overridden default browser focus styles globally, and not provided replacements.

Wim Leers’s picture

We've overridden default browser focus styles globally, and not provided replacements.

OMG!?

This seems to be the real problem, no?

seven's element.css does this:

a:hover,
.link:hover,
a:focus,
.link:focus {
  text-decoration: underline;
  outline: 0;
}

Shouldn't we move this to the seven.theme component?

andrewmacpherson’s picture

Re: #4

If we do this, shouldn't apply these styles/this pattern everywhere?

Probably. Currently we have a mixture of focus styles in various places; custom and default, some obvious, others subtle. I'd like to review all of our focus styles eventually; a consistent set of focus styles. We also have #1993574: Add focus styling to all interactive elements but it's about Bartik.

The CKEditor config UI currently doesn't have any focus styles for the individual buttons, even though it works. In WCAG terms we have something which is operable, but not perceivable. So it's a brick-wall barrier for a clear user group.

andrewmacpherson’s picture

Re: #7 Well, we've provided replacement link focus styles in lots of places, but when you override them globally you have a lot to maintain to reinstate them everywhere.

Wim Leers’s picture

#9: right, but isn't the problem that the Seven theme is overriding them globally? Is there a valid reason to do that?

andrewmacpherson’s picture

Issue summary: View changes

Re: #3, patch review:

Good idea re-using this yellow! It's actually nice and clear. However, it's also a colour-only indicator, and we shouldn't rely on colour alone.

I think we would be better to re-instate an outline as well, so we have a non-colour indication:

.ckeditor-buttons li a:focus {
  background: #ffee77;
  outline: 1px dotted;
}

The 1px dotted outline is what you would have got by default... in Firefox. The really awkward thing about using outline: none is that there's no way to re-instate the default style from a particular browser.

The patch in #3 modifies the Stable theme - I don't think we'll be allowed to do that, but we can change the CSS in Seven.

andrewmacpherson’s picture

re: #10

Is there a valid reason to do that?

No. It would only be acceptable if you were introducing a global focus style at the same time to replace it, preferably in the same CSS block.

BarisW’s picture

The patch in #3 modifies the Stable theme - I don't think we'll be allowed to do that

I'm not sure. I discussed this with Cottser and emma.maria whether these small changes (that don't change the API) should be allowed on stable if they are accessibility improvements. I'd love to discuss this some more.

andrewmacpherson’s picture

Priority: Normal » Major
Issue tags: +Needs design review

OK, if it can go in stable that's brilliant, otherwise we can change Seven and Bartik.

I'm bumping this to major, considering it's unusable for a particular group of users.

Also tagging for design review, since we need a visual change. We can minimise the impact by limiting ourselves ot a quick-fix in the CKEditor admin UI only.

Wim Leers’s picture

Title: Add keyboard focus styles to CKEditor toolbar configuration UI. » Seven theme disables all link focus styles, results in poor accessibility everywhere, including CKEditor's configuration UI
Component: ckeditor.module » Seven theme

Moving to Seven theme then.

andrewmacpherson’s picture

Title: Seven theme disables all link focus styles, results in poor accessibility everywhere, including CKEditor's configuration UI » Make Seven theme's link focus styles more robust for keyboard accessibility

Okay, that's an exaggeration ;-) Most links in Seven do get a focus style of some variety.

When Seven's elements.css does this:

a:hover,
.link:hover,
a:focus,
.link:focus {
  text-decoration: underline;
  outline: 0;
}

It removes the default outline focus style, then replaces it immediately with another focus style (underlining). This is fine, it's just what I said in #12, and it works for most links.

The problem we're seeing with the CKEditor admin UI "buttons" is that they don't have any visible text to underline, so effectively there's no focus style.

So, Seven's approach breaks focus styles for some links ;-) I guess the next step is to search for any other examples of links with broken focus styles.

Wim Leers’s picture

Right, my bad! Sorry!

Bojhan’s picture

I am wondering, what about using the blue style as a border? I guess using our actual button style "blue" with an underline is a bit much.

andrewmacpherson’s picture

Status: Needs review » Needs work

It turns out that Seven is the ONLY core theme where the CKEditor toolbar config UI buttons don't get a focus style.

I checked what the CKEditor toolbar config UI looked like with other core themes: Bartik, Stark, Classy, and Stable. I commented out the hidden: true lines to test them as admin themes. Apart from Seven, they all show default focus styles in Firefox, Chromium, Opera.

So this is correctly assigned to the Seven theme component.

andrewmacpherson’s picture

@Bojhan #18

Yes, the blue "glow" box shadow that we use on buttons elsewhere could be used. I just played around with it in Firebug, and it's nice and easy to follow when you use the tab and arrow keys in the CKEditor admin UI. It could do with having a stronger colour contrast against light backgrounds (more blue), but it provides a shape-based indication which is GREAT.

andrewmacpherson’s picture

Title: Make Seven theme's link focus styles more robust for keyboard accessibility » Make Seven theme's link + buttonfocus styles more robust for keyboard accessibility
andrewmacpherson’s picture

Title: Make Seven theme's link + buttonfocus styles more robust for keyboard accessibility » Make Seven theme's link + button focus styles more robust for keyboard accessibility
Bojhan’s picture

@andrewmacpherson Do you have a screenshot. I'd largely prefer to reuse existing patterns when they suffice. Most of the other buttons are on on white backgrounds, except in the modal. So it should pass WCAG.

mgifford’s picture

I think the "Active toolbar" buttons focus disappearing the user tabs from the group to the buttons will be addressed here too. The focus works nicely on the group, just not on the button.

Focus on group but not on the buttons

Also, wanted to through out this little appeal http://www.outlinenone.com/

Chernous_dn’s picture

Status: Needs work » Needs review
FileSize
934 bytes
36.95 KB

Add style from comment #11:

.ckeditor-buttons li a:focus {
  background: #ffee77;
  outline: 1px dotted;
}

To core\themes\seven\css\components\ckeditor\ckeditor.admin.css
And include in seven.libraries.yml
Pls look I'm moving in the right direction?

mgifford’s picture

This looks great to me!

mgifford’s picture

There's an earlier issue of CKEditor just leveraging <a> tags for everything here https://dev.ckeditor.com/ticket/9988

Mostly highlighting it for those who are bothered by that.

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should 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.

BarisW’s picture

Status: Needs review » Reviewed & tested by the community

Perfect! Really happy with this. The patch in #25 misses a newline, but that can be fixed while committing.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

The CSS added here is loaded on every admin page. We should extend the drupal.ckeditor.admin library in seven to include this CSS - that seems like the best fix to me. You can use the libraries-extend in the theme's info.yml to do this.

BarisW’s picture

Status: Needs work » Needs review
FileSize
1.23 KB

Good point Alex. I've used the extend-library technique.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

I've tested the new patch in Firefox & Chrome. Looks great. Just like the screenshot up in the issue's description.

I'm marking this RTBC.

Wim Leers’s picture

Awesome work :)

+++ b/core/themes/seven/css/components/ckeditor/ckeditor.admin.css
@@ -0,0 +1,4 @@
+.ckeditor-buttons li a:focus {

Shouldn't this document that this is bringing back focus styles for this particular type of button? See #16, #19, and related comments.

Otherwise future maintainers will be surprised this is even there.

mgifford’s picture

Speaking of comments, shouldn't we add this to the top of core/themes/seven/css/components/ckeditor/ckeditor.admin.css

/**
 * @file
 * Seven styles for the administration pages.
 */

Also, before bundling it in a patch, we'd want to add a comment something like this above .ckeditor-buttons to explain what this is here for, right?

/**
 * Add CSS to see that the buttons are visible on focus for keyboard-only users.
 */
BarisW’s picture

Here goes!

mgifford’s picture

Issue tags: -wcag2 +wcag
star-szr’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/themes/seven/css/components/ckeditor/ckeditor.admin.css
@@ -0,0 +1,12 @@
+ * Seven styles for the administration pages.

Minor: Maybe this should say "for CKEditor administration pages".

So if this is only for Seven, per #18 and #20 it would make sense to me to use the established Seven focus style (blue glow) instead of this. I didn't see a reason not do to this in the remaining comments.

https://groups.drupal.org/node/283223#Buttons

Bojhan’s picture

I think Cottser is right, I am also quite sure we should just use the blue glow.

mgifford’s picture

I'm fine with going with the blue glow for the buttons. It won't be as noticeable as the yellow. The example though is quite different from the instance here. In most other cases there is more space around the buttons than there is here.

Bojhan’s picture

@mgifford Am I correct in stating, that is a personal opinion not a accessibility issue?

We chose not to go as noticeable as you wish, that was a design decision on Seven. We can revisit that, but that would need to be a new issue - because we shouldn't do that as a one-off.

mgifford’s picture

@Bojhan - sorry, I should have been more clear. Yes, I don't see an accessibility difference between one and the other. And yes, agree that this shouldn't be done as a one-off.

mgifford’s picture

Status: Needs review » Needs work

reroll needed to just go with the blue glow rather than the yellow.

Vidushi Mehta’s picture

FileSize
1.44 KB
30.13 KB

Adding a patch with above mentioned change.
Adding screenshot for the same.

mgifford’s picture

Status: Needs work » Needs review

Interdiffs are always appreciated.

BarisW’s picture

+++ b/core/themes/seven/css/components/ckeditor/ckeditor.admin.css
@@ -7,7 +7,7 @@
+	border-color: #40b6ff;
+	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 0 8px #40b6ff;
+	outline: medium none;

Tabs instead of spaces?
Other than that, it looks good.

Status: Needs review » Needs work

The last submitted patch, 43: 2735421-43.patch, failed testing.

Vidushi Mehta’s picture

FileSize
1.44 KB
861 bytes

Adding patch with corrections and interdiff as well.

Vidushi Mehta’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 47: 2735421-47.patch, failed testing.

amit.drupal’s picture

Apply Patch #47 found issues.

amit.drupal’s picture

@Vidushi Mehta update your patch.

amit.drupal’s picture

FileSize
1.31 KB

Update patch #47

amit.drupal’s picture

Status: Needs work » Needs review
Vidushi Mehta’s picture

FileSize
1.43 KB

Ya checked that @amit.drupal. Updating a new patch. Hope it works.

The last submitted patch, , failed testing.

Status: Needs review » Needs work

The last submitted patch, 54: make_seven_theme_s_link-2735421-52.patch, failed testing.

Vidushi Mehta’s picture

Status: Needs work » Needs review

I m not getting it why the patches are continuously failed testing

Manjit.Singh’s picture

Patch applied cleanly on local env, but Operation timed out after 30001 milliseconds with 0 bytes received.
Seems like this is diffrent issue, not related to code, I assume.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should 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.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should 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.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should 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.

andrewmacpherson’s picture

Queue another test against current dev branch.

It would be a good to get before-and-after screenshots of the most recent patch here.

It's worth getting screenshots for the patch here, but now that the new admin theme is underway (codename Claro) we can just aim to fix any poor/missing focus styles in Seven. I don't think it's worth a design overhaul for an admin theme we intend to replace.

Back in #16 I said:

It removes the default outline focus style, then replaces it immediately with another focus style (underlining). This is fine,

However, I now think this is a bad idea, since the majority of our links in the Seven theme fail WCAG Use-of-Color, specifically by not having underlines in the resting state (not focused, not hovered). See #2958282: Links inside surrounding text fail WCAG Use-of-Color in Seven theme.

apaderno’s picture

Version: 8.6.x-dev » 8.9.x-dev
Issue tags: -needs screenshots. +Needs screenshots
rensingh99’s picture

Hello,

I have checked the patch #52 and it failed to apply with 8.9x.

I have made it compatible with 8.9x and uploading a patch.

I am also attaching a screenshot before and after applying the patch.

Below is a screenshot before applying the patch.

Below is a screenshot after applying the patch.

The patch is working great.

Thanks,
Ren

bnjmnm’s picture

Status: Needs review » Needs work

This looks great and I'm glad @kiamlaluno and @rensingh99 got this moving again. Among other things, I compared the use of box-shadow to other usages in core and it looks fine.
Two tiny things and I think I can RTBC it.

  1. +++ b/core/themes/seven/css/components/ckeditor/ckeditor.admin.css
    @@ -0,0 +1,13 @@
    + * Add CSS to see that the buttons are visible on focus for keyboard-only users.
    

    This would benefit from rephrasing. It's self-evident that that CSS is being added so that's unnecessary, and focus rings benefit more than keyboard-only users (voice navigation, for example), so it's not necessary to specify who this is for either. It's most helpful to explaining that a focus ring is being added due to it being disabled elsewhere in the theme with a @see referencing the file with the rule disabling the focus ring.

  2. +++ b/core/themes/seven/css/components/ckeditor/ckeditor.admin.css
    @@ -0,0 +1,13 @@
    +  outline: medium none;
    

    This is an ubernit, but box-shadow should be the final rule. This is due to the declaration order specification in Drupal's CSS formatting guidelines. Border and outline are box-model declarations, which should come before box-shadow which is considered an "other" declaration. Which rule falls under which classification is not always clear or easy to remember, so its useful to reference drupal/core/.stylelintrc.json for this. This file can also be integrated in PHPStorm and other editors to highlight the formatting rules automatically.

After those two small changes this should be in good shape, I think this will be very appreciated by users not using pointer devices!

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.

komalk’s picture

Status: Needs work » Needs review
FileSize
1.35 KB
1.74 KB

Updated patch as mentioned in #67. Please review.

apaderno’s picture

The first point on comment #67 has not been addressed.

komalk’s picture

@kiamlaluno Covered both the point in patch #69

apaderno’s picture

There isn't any comment explaining that a focus ring is being added due to it being disabled elsewhere in the theme with a @see referencing the file with the rule disabling the focus ring. This is what I take one of the points in a previous comment meant.

+++ b/core/themes/seven/css/components/ckeditor/ckeditor.admin.css
@@ -0,0 +1,13 @@
+ * Add CSS to see that the buttons are visible on focus for keyboard-only users.

This would benefit from rephrasing. It's self-evident that that CSS is being added so that's unnecessary, and focus rings benefit more than keyboard-only users (voice navigation, for example), so it's not necessary to specify who this is for either. It's most helpful to explaining that a focus ring is being added due to it being disabled elsewhere in the theme with a @see referencing the file with the rule disabling the focus ring.

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.

mgifford’s picture

Status: Needs review » Needs work

So the comment needs work as per @kiamlaluno's last comment.

apaderno’s picture

The comment could be changed to the following, for example.

The focus ring is being added because it's disabled in [relative path for the file containing the disabling rule].
@see [link to the file]

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.

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.

longwave’s picture

Project: Drupal core » Seven
Version: 9.5.x-dev » 1.0.0-alpha1
Component: Seven theme » Code

The Seven theme has been removed from Drupal 10 core, and CKEditor 4 will soon be removed as well. I confirmed that this issue only affects Seven and no other themes included with Drupal core, so I am moving this to the contributed Seven project.