Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
Problem/Motivation
The CKEditor toolbar buttons in the "available buttons" area are missing focus. This is violation of W3C 2.4.7 Focus Visible (Level AA)
Steps to reproduce
- Install Drupal using Umami
- Login as admin
- Go to
/admin/config/content/formats/manage/restricted_html
- Select a "Text editor", ie. CKEditor
- Try to focus one of the available buttons in the toolbar configuration, items receive focus but it's not visible
Proposed resolution
Make focus visible on these elements.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#42 | 3202493-42.patch | 2.5 KB | bnjmnm |
#42 | claro-focus2.png | 103.39 KB | bnjmnm |
#42 | claro-focus1.png | 57.74 KB | bnjmnm |
#38 | 3202493.38.patch | 1.36 KB | sakthivel m |
#35 | After patch.png | 87.4 KB | manojithape |
Issue fork drupal-3202493
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- issue-3202493 changes, plain diff MR !556
- 9.2.x changes, plain diff MR !467
- 3202493-claro-is-missing changes, plain diff MR !468
Comments
Comment #2
lauriiiComment #4
jenniferhoude CreditAttribution: jenniferhoude as a volunteer and at CivicActions commentedComment #8
jenniferhoude CreditAttribution: jenniferhoude as a volunteer and at CivicActions commentedAdded styling for hover and focus on toolbar configuration for ckeditor admin UI.
Here is a current patch that will work.
Comment #9
jenniferhoude CreditAttribution: jenniferhoude as a volunteer and at CivicActions commentedComment #10
jenniferhoude CreditAttribution: jenniferhoude as a volunteer and at CivicActions commentedComment #11
bnjmnmThe issue is scoped as an issue with Claro, but the changes are made to the CSS in the CKEditor module. This would result in Claro's focus styling being applied to all themes (that don't override this style). If it's a Claro-specific issue, the change should be made in Claro.
Comment #12
mradcliffeI performed Novice Triage on this issue. I added the Novice tag as well as NorthAmerica2021 and Easy out of the Box to increase visibility. I unassigned the issue because there hasn't been any work in a few weeks. We should leave it unassigned and use comments to mention that we are working on the issue and when we're done.
It looks like the next steps per bnjmnm's review in comment #11 is to assess the scope of the issue and apply jenniferaube's patch in Claro directly if it does not apply to all themes.
It looks like there is a merge request and a patch. We should choose one of those options and mention which is the work to review in the issue summary.
Comment #13
jenniferhoude CreditAttribution: jenniferhoude at CivicActions commentedComing back to this in DrupalCon NA 2021 contribution April 14th
Comment #14
jenniferhoude CreditAttribution: jenniferhoude at CivicActions commentedComment #16
jenniferhoude CreditAttribution: jenniferhoude at CivicActions commentedCreated new MR with patch attached. Added css to Claro core theme rather than ckeditor module.
Comment #17
jenniferhoude CreditAttribution: jenniferhoude at CivicActions commentedComment #18
bnjmnmHi @jenniferaube, it looks like your patch/MR is failing because you are editing the css file directly instead of the .pcss.css file that is used for compiling the CSS. This is not particularly intuitive 🙂. Info on working with Claro CSS can be found here https://www.drupal.org/docs/8/modules/claro/development
Comment #19
bnjmnmComment #20
vsujeetkumar CreditAttribution: vsujeetkumar at Material for Drupal India Association commentedComment #21
vsujeetkumar CreditAttribution: vsujeetkumar at Material for Drupal India Association commentedComment #22
mgiffordThis is a pretty simple change.
Here's a before shot:
And the after shot:
I think this is good.
Comment #25
catchRestoring status after HEAD was broken.
Comment #26
gauravvvv CreditAttribution: gauravvvv at OpenSense Labs commentedAfter patch #20, I am getting double focus on Active toolbar items.
Attaching a screenshot for reference.
Comment #27
lauriiiMoving back to needs work to address #26.
Comment #28
bnjmnmThe focus outline isn't missing in the entire toolbar configuration, just the "Available buttons" area. This is due to the following rule in CKEditor's ckeditor.admin.css
The issue summary should be updated to specify where the problem is happening. Ideally, the solution would apply Claro's green focus outline instead of the browser default, so it is consistent with the other outlines.
Comment #29
sakthivel m CreditAttribution: sakthivel m at QED42 for Drupal India Association commentedProviding updated version of patch #29 as per comment #28
Comment #30
bnjmnmThis is added to the global styling library, which loads it on every page. This only needs to be loaded on pages with CKEditor. This can be accomplished by extending the ckeditor/drupal.ckeditor library instead.
Comment #31
bnjmnmComment #32
vsujeetkumar CreditAttribution: vsujeetkumar at Material for Drupal India Association commented@bnjmnm I have worked on #30, I found that library(ckeditor/drupal.ckeditor) already extended, After adding css file withing the library, Its not working. However Its working fine with library(core/ckeditor). I have created the patch, Please have a look and advise.
Comment #33
guilhermevp CreditAttribution: guilhermevp at CI&T commentedManual test for new patch extending library(core/ckeditor) work as intended.
Before patch:
After patch:
RTBC +1
Comment #34
manojithape CreditAttribution: manojithape at QED42 for Drupal India Association commentedComment #35
manojithape CreditAttribution: manojithape at QED42 for Drupal India Association commentedVerified and tested patch MR !556 i.e. https://git.drupalcode.org/project/drupal/-/merge_requests/556.patch on the drupal 9.3.x-dev version and Claro 9.3.0-dev version. Patch applied successfully and looks good to me.
Testing Steps:
Testing Results:
After applying the patch by pressing the tab focus is visible for the toolbar items.
Please refer attached Before patch and After patch images for reference.
Moving this ticket to RTBC.
Comment #36
manojithape CreditAttribution: manojithape at QED42 for Drupal India Association commentedComment #37
bnjmnmSwitching back to needs work
ckeditor.admin.css
, so the solution should be an extension of the library that adds that file.ckeditor.admin.css
, is loaded by the libraryckeditor/drupal.ckeditor.admin
(seeckeditor.libraries.yml
), so that is the correct library to extend.Comment #38
sakthivel m CreditAttribution: sakthivel m at QED42 for Drupal India Association commentedProviding updated version of patch #38 as per comment #37
Comment #40
gauravvvv CreditAttribution: gauravvvv at OpenSense Labs commentedComment #41
bnjmnmThe existing extension of
ckeditor/drupal.ckeditor
shouldn't be changed.A new libraries-extend item should be added for
ckeditor/drupal.ckeditor.admin
The CSS shouldn't be added to this existing file. This stylesheet is for styling the editor itself. The fix is updating the styles of the ckeditor admin form.
This should be in a new stylesheet that is part of a new library, specifically created to extend
ckeditor/drupal.ckeditor.admin
. To get a better sense of what needs to go in what library/extension, check out ckeditor.libraries.yml to see which files belong to which library. Claro's extensions should maintain that structure.Comment #42
bnjmnmIt doesn't look like I have permissions to change the version the merge request is compared against, so here it is in patch form.
This loads the fix CSS only when the problem-causing CSS is loaded. It fixes the lack of focus in the available buttons row without impacting the already-working focus elsewhere.
(I wanted to mention there's a bit of unexpected time sensitivity to this issue due to CKEditor 5. Typically I wouldn't want to jump in on something I've already been reviewing when contributors haven't had much time to respond to feedback. Find me on Drupal slack if anyone wants help finding/finishing other issues 🙂)
Comment #43
zrpnrThe patch in #42 extends the
ckeditor/drupal.ckeditor.admin
library which is where the conflictingbox-shadow
is added.That means this claro override only loads with that library.
The
claro/ckeditor-admin
just loads one file,css/theme/ckeditor.admin.css
which overrides
core/modules/ckeditor/css/ckeditor.admin.css
.ckeditor-toolbar-disabled .ckeditor-buttons li a
box-shadow
by targeting the:focus
This is the solution pointed out in #28.
It's non-destructive, as opposed to just deleting that box shadow from the core ckeditor css, so any themes that expected the old box shadow won't be affected. It adds it just for the ckeditor disabled toolbar items.
Followed the steps in #35 and confirm that the library loads correctly and the focus style from Claro is
no longer overridden by the ckeditor box-shadow. edit: more specifically, the override matches Claro's normal focus style for box-shadow.Comment #46
lauriiiCommitted f881860 and pushed to 9.3.x. Thanks!