Problem/Motivation
To reproduce this issue, view the html in #9 in IE11.
In IE11, any element set to display: flex; can receive focus by being clicked. This has been narrowed down to an IE bug, but one that has very little evidence of it existing online because it is only noticeable if stylesheets include rules that provide focus outlines to non-interactive elements. This is the case with Claro's :focus styles, as they are are applied as *:focus, impacting all elements. This can result in the green focus ring appearing in unexpected places.
The bug does not result in making these elements tabbable via tab navigation, but clicking on one of these non-interactive-but-focusable elements will take focus away from another element .

Proposed resolution
Any number of CSS rules could address the problem.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #53 | 3048785-nr-bot.txt | 144 bytes | needs-review-queue-bot |
| #50 | 3048785-50.patch | 4 KB | _utsavsharma |
| #50 | interdiff_40-50.txt | 957 bytes | _utsavsharma |
| #40 | interdiff-38-40.txt | 711 bytes | imalabya |
| #40 | 3048785-40.patch | 4 KB | imalabya |
Issue fork drupal-3048785
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:
- 3048785-ie-focuses-elements
changes, plain diff MR !900
Comments
Comment #2
mgiffordNo idea how to address this. How much longer do we need to support IE11?
Comment #3
lauriiiInternet Explorer 11 is still at 2.37% market share, and Microsoft is committed to supporting at least until October 14, 2025. It seems like we are going to have to support it for quite some more time.
Comment #4
andrewmacpherson commentedI haven't heard about this problem with IE11. Is it documented elsewhere? Can you provide more detail about which divs you're concerned about, and steps to reproduce?
You're supposed to be able to position focus that way, in any browser. You can use a pointer to click on approximately the correct area of the page (usually in an area of whitespace), then press tab to move forward through operable controls from that point onwards. That's how I normally operate web pages. A lot of users who have difficulty with pointers do this; we are keyboard-mostly, rather than keyboard-only.
Visible focus indicators are only needed when an operable control has focus.
Ideally, they should be applied globally. Otherwise you have to maintain
:focusrules for a gazillion different components. Seven has a lot of custom focus styles for individual components, and it would be good to avoid that, or at least greatly reduce the number of instances.Comment #5
shaalStep to reproduce -
On IE11, Umami installation + Claro.
/node/1/editAs you can see in the screenshot below, clicking on an area (outside the items of the form) will mark it with an outline:

I created a patch that removes that outline
form-wrapper.Comment #6
lauriiiI think this might cause some issues because this will increase the weight of this selector. This is also very specific to a single instance, where as this happens in a lot of different places. I'm wondering if there's another path we could try?
Comment #7
shaal@lauriii
Patch #5 is now using
.page-wrapper *:focus:not(.form-wrapper)Would you prefer instead of that, adding a specific rule that hides the box-shadow?
Comment #8
bnjmnmIn a pinch, this rule will take care of things and (I think) won't result in any unwanted side effects.
I'm not quite ready to add this to a patch, though, as I'd like to better understand what leads to this happening as the css rule above may not be the optimal solution.This is a bad solution - it was an approach considered before the underlying IE11 bug was identified.
Comment #9
bnjmnmI created a plain-html page and loaded it in IE11. If a div is set to
display: flex;it receives focus when clicked on... It must be a bad Google day for me as I can't find this mentioned anywhere online, it seems like something that would have been discovered and discussed by now. This is the html I used in IE11:Comment #10
eleleka commentedIt seems not only flexbox is affecting on focus, but also changing display rendering in general. Using HTML example above, I've added inline styles and classes with float, and various display properties, and each time I saw focus issue in IE11.
Me neither found any mention about such bug.
Looks IE11 understands literally this rule
*:focusComment #11
fhaeberleComment #12
fhaeberleComment #13
andrewmacpherson commentedCan someone clarify which divs are known to be affected? The summary just says "some divs". I think @lauriii is also asking for the same thing in #6
Comment #14
huzookaComment #15
bnjmnmComment #16
bnjmnmComment #17
mradcliffeI removed the novice tag at the moment and fixing the event tag.
Comment #18
martijn.cuppens commentedI've made a demo to illustrate this issue:
https://jsfiddle.net/martijncuppens/z9fnydv1/4/
Whatever we try, we'll need to increase CSS specificity to fix this (unless we can rely on native custom properties).
Why don't we just update the Toolbar and Settings Tray CSS?
Then we can update the CSS to something like:
Comment #19
kostyashupenkoI just checked it looks like this bug is supposed to be everywhere, where parent html-tag has "display: flex" property, no matter what is inside, this tag gets focus ring.
So!
Honestly i don't know a way how we could manage that, instead of only rewriting:
to something more obvious, with sensitivity to all possible cases, like:
Comment #20
bnjmnmWent with a version of what was suggested in #19. It's targeted to IE, so all other browsers still get the
styling. The elements targeted is based on the ally.js list of focusable elements https://allyjs.io/data-tables/focusable.html
Comment #21
lauriiiNice! While it would be nice to not have to worry about the consequences of the increased selector specificity, it seems like it might be the only way to fix this problem.
I started wondering what are the major benefits of having these more specific selectors only for IE 11? I feel like we have to give some serious thought whether it's an approach we want to take. I'm mostly concerned that having this large deviation between IE 11 and the rest of the browsers will make Claro more prone to IE 11 bugs.
Comment #22
bnjmnmThe decision to go IE11 specific was:
*:focusapproach to styling the rings. I thought this may have a better chance of making it through the gates if that approach is only altered in circumstances where it's absolutely necessary.Neither of those are strong opinions, though! Just my thought process for this first patch. I also think the ability to reference the allyjs table makes a specific-selector approach a much safer option in general.
Comment #23
lauriiiComment #24
bnjmnmComment #25
bnjmnm@supports, which works with all Drupal supported browsers other than IE11, so it's fine to use this for this specific kind of targeting..classname *:focusis.classname TAG:focusin IE11. I grepped for all :focus in the rest of Claro's CSS and looked for rules that style box-shadow or outline, with selectors that would override.classname *:focus, but not.classname TAG:focus. In these cases, I added an IE11 media query that provided selectors with specificity that would successfully override the default focus styling as expected.Comment #26
deepalij commentedComment #27
deepalij commentedVerified and tested by applying patch #25. Looks good to me.
Can be moved to RTBC.
Comment #28
lauriiiDiscussed this with @rainbreaw and she said she would like to review this. Assigning this to her and moving back to needs review until she has had a chance to take a look at this.
Comment #29
bnjmnmI did a bit of discovery after the discussion with @rainbreaw that was mentioned in #28. I confirmed that when these shouldn't-be-focusable elements are clicked and get a focus outline, they do become IE11's active element. I had previously thought the bug was purely cosmetic, but since focus is actually changed, the current solution of hiding the outline is not a viable one. @rainbreaw correctly pointed out that if an element receives focus - even due to a bug - that focus state should still be visible. This will need to be addressed in a different way.
Comment #30
bnjmnmNone of the previous patches I provided will work because it's not addressing the underlying problem of elements receiving focus when they shouldn't. Those patches would hide the focus ring in those instances, improving things visually but making the experience less accessible.
This approach adds a mousedown listener and prevents focus on elements that should not receive it. I was initially concerned about side effects as this is a somewhat broad solution, but the
preventDefault()will not occur on anything that is truly focusable.Comment #31
bnjmnmComment #33
mgiffordLinking open issues from the CivicActions Accessibility - VPAT.
Comment #35
sakthivel m commented#30 Patch failed
Comment #36
sakthivel m commented#36 Please review the patch
Comment #37
gauravvvv commentedRe-rolled patch #36, Attached interdiff for same.
Comment #38
chetanbharambe commentedVerified and tested patch #37.
Patch applied successfully and looks good to me.
Testing Steps:
# Goto: Appearance -> Apply Claro theme
# Go to any content -> Edit it
# Click on any elements
# User is able to see Green focus
Expected Results:
# IE focuses elements on click that should not be focusable, and Claro makes this very apparent.
Actual Results:
# Currently User is able to see Green focus.
Looks good to me.
Can be a move to RTBC.
Comment #39
nod_we can add the nomodule attribute to the script to make sure it's only executed in "old" browsers.
The patch still has some lint issues (dictionnary).
Comment #40
imalabyaAdded the
nomoduleattribute and dictionary.Comment #42
nod_Comment #43
volkswagenchickTagging for Design4Drupal 2021. Contributions are Friday, July 22
https://design4drupal.org/
Comment #44
volkswagenchickCorrecting tag Design4Drupal2021
Comment #47
smustgrave commentedClosing as outdated since Internet Explorer is no longer a supported browser
Comment #48
bnjmnmDrupal 10 doesn't support IE11, but Drupal 9 does, and that will not be EOL until November 2023
Comment #50
_utsavsharma commentedFixed CCF for #40.
Please review.
Comment #51
_utsavsharma commentedComment #52
mgifford@bnjmnm can we keep the Version at Drupal 9, since we don't need to support this for Drupal 10?
Just trying to prepare an ACR for D10, and wanting to exclude stuff that isn't relevant.
Comment #53
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #54
bnjmnmSwitching version to Drupal 9 as Internet Explorer is not supported by Drupal 10.
Comment #55
ckrinaClosing since we don't support IE11 anymore after #3254202: Remove IE11 Support from Claro.