Moving from #418306: Adding Visual Focus to Form Elements and sparked by this recent webaim post on easy accessibility tips.

"Sighted keyboard users generally navigate through the links and form fields on a web page using the Tab and Shift+Tab keys on the keyboard. To help ensure they can visually identify which link or form field they have navigated to, you can add the following to your CSS file:

a:focus {
outline:1px solid red;
background:yellow;
}

The colors may need to be customized to fit your site design, but they should be fairly distinctive.

To take this tip one step further, you can search your CSS files for a:hover and in each instance change it to a:hover, a:focus. This will ensure that keyboard users get the same visual highlighting when they navigate to items as mouse users get when they hover over an item."

After a little discussion it was discussed that although this should be brought up with the browsers, having a theme specific focus for elements on focus elements could be a very nice touch:
https://twitter.com/opdavies/status/333590693731782656

In Drupal 7 this was seen as a browser responsibility, particularly with the form elements. However, the link focus as suggested by webaim provides one that will benefit a broader group of elements.

Comments

Bojhan’s picture

Title: Add Visual Focus for Core Themes » Add focus styling to all elements

The twitter argumentation is a little weird, just because someone saying "yes" on twitter :P?

I am not against this, but keep in mind that focus also shows upon clicking of fields. For which we have "focus" styles, we should not overwrite those. I also don't think he suggestion of a red outline, would fit very well with most designs - this includes Bartik. Browser default focus styles, tend to be quite nice - we should replicate some of that.

mgifford’s picture

Status: Active » Needs review
StatusFileSize
new344 bytes

My local install is messed at the moment, but wanted to put up their initial example as a patch to start with.

Totally about the twitter "yes" I should have downplayed that. Oliver's been contributing to the Skype chat, over the years which is the more relevant thing.

It would be nice to be able to incorporate some of the elements from the Color module if people are using that. Not sure how to leverage other design choices.

I'm totally open to finding more appropriate (and more subtle) focus. It should look nice, not mess with user contrast (for both dark/light link text color) and not mess up other "focus" styles.

Was thinking too about how more folks like David Pogue are encouraging people to learn how to use their keyboard for time savings online (this is only vaguely related):
https://www.ted.com/talks/david_pogue_10_top_time_saving_tech_tips.html

mgifford’s picture

StatusFileSize
new133.69 KB

Yes.. Definitely requires much more thought:
focus link problems on quite  a few pages.

Bojhan’s picture

@mgifford Hehe, oke - yes this looks afwul :P

So could you explain a little why this is not a browser concern? Because that's why we didn't pursue this before, we did take into account "focus" status on buttons but not all elements in the style guide because its largely already done by the browser. Often we can get away with the hover state, in many cases we can't.

kat3_drx’s picture

The issue of outline:0 in CSS resets was addressed in Drupal 7, and allows browsers to add back in the default link outlines. One issue I can see with continuing to rely on the browser is that the browser's default outlines (often the "dotted lines") have not changed over the years to better accommodate accessibility, and do not accommodate the look and feel of all themes. A theme with a dark background color would potentially render the theme useless to low-vision users because it doesn't provide an adequate color contrast ratio.

Maybe a solution would be to provide a thicker, more contrasting outline to links instead of a link outline and color fill? A 3 - 5 pixel outline with a bright(ish) shade of yellow seems to be the industry standard for accessibility-minded folks. See the Section 508 site and the Youtube video player for examples. Naturally, whatever the solution, the CSS could be easily overridden within the theme to change the color if the default color still doesn't provide the right contrast.

mgifford’s picture

StatusFileSize
new66.68 KB

Thanks Kate!

I was trying to put forward some examples, and found the Youtube videos useful in this screenshot:

Youtube screen shot with focus on post-video keyboard focus elements

But I couldn't find it in the video player sadly. Not sure why, but maybe it is a Mac or FireFox thing.

There are certainly other options to consider that are an popular use. The dotted lines are not that good.

EDIT, I should add About (active), Share (focus), Add to (hover) - the active & hover look the same here.

kat3_drx’s picture

StatusFileSize
new193.09 KB

Hi Mike,

Thanks for looking into this more! The Youtube player has been a little weird in Firefox lately, but I managed to get a screenshot of the border I was talking about:

Youtube video player controls with yellow border around the minimiz button

The yellow border like this seems to be a standard default. It probably won't be pretty in every theme, and may not even match color contrast in all themes, but if it was made easily-override-able in the theme, having a default like this could help, and serve as a helpful reminder to themers to include this.

mgifford’s picture

StatusFileSize
new48.8 KB
new64.01 KB
new25.37 KB

One argument against letting the browser handle it is that they don't do it in the same way.

Chrome/Safari do it basically the same way, but Firefox doesn't (least on the Mac). I have filed a bug with them.

Here are some screenshots (from this page) with default link, hover link & focused link:

FireFox Default Focus

Safari Default Focus

But I'm still looking for examples of how setting in Drupal can clearly improve the UI & also a11y.

kat3_drx’s picture

I concur, Mike. As I mentioned in yesterday's comment, this default is weirdly unsatisfactory when it comes to accessibility, specifically for low-vision users or anyone who has a problem with color contrast or very small details.

Furthermore, it really would not be that hard for us to add a default to the Bartik core stylesheet, no? If people don't like the look of it, they can override it, but as was mentioned on Twitter, adding it by default makes it one less thing that can be forgotten for accessibility in constructing a theme (not to put a negative spin on this).

mgifford’s picture

StatusFileSize
new256.61 KB

I decided to look at ideas from the Drupal disability community on this - http://groups.drupal.org/node/268908

I think one of the best examples I've seen is not surprisingly from http://www.paciellogroup.com

focus better practices

Bojhan’s picture

I do think this needs some realignment with visual designers, I think we are working under very different standars as what looks acceptable - none of the designs proposed to me look acceptable. Ideally we choose a toned down browser default style, and apply it elsewhere (e.g. the chrome one).

I'd like to point to the idea that "ohh they can just change it" is not an argument for anything. Bartik is the default we present Drupal with, it is what people out of the box evaluate and if it has elements that would make Drupal not good looking - it will reflect badly upon Drupal, you know Garland did this.

I'd personally prefer to style individual elements with the correct focus styling, the chrome styling gets us really far and its not as obtrusive as is being suggested in this thread. It will not work for all elements (e.g. VT's) and we will need to style those separately, keep in mind we have loads of hover styles that are perfectly transferable to focus.

However I am still not sure we should overwrite default browser styling, aren't people used to that styling? Wouldn't Drupal breaking that styling interfere with a established standard - that people might even have tweaked for contrast? Also the few browsers that don't provide a default focus styling, should get their act together its not Drupal's job to fix these kinds of bugs in firefox.

mgifford’s picture

Thanks Bojhan!

If we're going to bring this into D8 it does need to fit closely with Bartik & Seven's themes & also work well with the Color module.

I wasn't suggesting that we'd found the right solution, simply posting a few of the options I could find as examples. Only at a brain storming stage.

On the Mozilla front, this issue hasn't been actively discussed since 2008.
https://bugzilla.mozilla.org/show_bug.cgi?id=53927

Steve Faulkner said on this issue: "@mgifford as a matter of course we advise clients to apply CSS outline styles as the default styles across elements and controls are [crappy]"

I do like how the http://paciellogroup.com (bottom right image) inverts the foreground/background color on hover. Their CSS is:

.header-menu a, #precontent a, #content a, .header-menu a:active, #precontent a:active, #content a:active {
    color: #123A63;
    display: inline-block;
    padding: 0.2em 0.3em;
}
.header-menu a:hover, #precontent a:hover, #content a:hover, .header-menu a:focus, #precontent a:focus, #content a:focus {
    background-color: #123A63;
    border-radius: 0.5em 0.5em 0.5em 0.5em;
    color: #FFFFFF;
}
opdavies’s picture

Inverting colours in what we tended to do whilst I was at Nomensa - e.g. http://www.nomensa.com/blog.

opdavies’s picture

At the very least, the state for :focus should be the same as :hover.

mgifford’s picture

My screenshot in #10 above had one link in focus and one link hovered. So many of them were different. Agreed that its not a good practice though.

shanly’s picture

Has the discussion for this problem moved to another issue? My reading of this thread suggests that this patch doesn't correctly fix the problem. Should this issue be in "needs work?"

mgifford’s picture

Status: Needs review » Needs work

Yes, agreed that this patch needs work. We don't have an identified solution yet.

mgifford’s picture

This came up https://groups.drupal.org/node/303268#comment-934858 and @suntog brought up how this would be useful for tablets too. Decided to try out http://www.paciellogroup.com to see how it looked on an iPhone. It does really add some nice usability.

mgifford’s picture

We're trying the following on an AdaptiveTheme base:

a:hover, a:focus {
  text-decoration: underline;
  color: #512b8b;
}

a.active:hover, a.active:focus {
  color: #fff !important;
  font-weight: 950; 
}

a.active:hover img, a.active:focus img {
  border-radius: 0; 
  padding: 0;
  color: #512b8b;  
background-color: #fff;                                                                                                     
}

#content a {
  color: #512b8b;  
  text-decoration: underline;  
}                                                                                                                                                                                                                                             
#content a:hover, #content a:focus {   
  text-decoration: none;
  color: #fff;
  background-color: #512b8b; 
  padding: 2px;  
  margin: -2px;   
}                                                                                                                                                                                    

#content a:hover img, #content a:focus img {
  background-color: #fff; 
  padding: 2px; 
  margin: -2px;  
}
mgifford’s picture

Issue summary: View changes
StatusFileSize
new93.54 KB

Knowability has a good example of how they apply this on their site:

.bodyLink:link, .bodyLink:visited {
    background: none repeat scroll 0 0 rgba(0, 0, 0, 0);
    border-bottom: 1px solid #C6D6E4;
    color: #205988;
    padding: 0.2em 0.2em 0;
    text-decoration: none;
}
.bodyLink:hover, .bodyLink:focus {
    background: none repeat scroll 0 0 #427BAB;
    border-bottom: medium none;
    border-radius: 3px;
    color: #FFFFFF;
    padding: 0.2em;
    text-decoration: none;
    text-shadow: 1px 1px 2px #000000;
}

Knowability examples for links.

mgifford’s picture

StatusFileSize
new20.71 KB

Looking at the comments on #890362-114: Links should not be indicated by color only I'm thinking this might be a more subtle way to do this.

Maybe other folks could review/fork this CSS concept:
http://jsfiddle.net/mgifford/h4fD7/5/

View of jsfiddle interface with possible option

mgifford’s picture

I'm quite impressed at the keyboard focus for http://webaim.org right now.

I like the transition from:

main a:link, main a:visited, aside a:link, aside a:visited {
    color: #20399d;
    outline: 0 none;
    transition: background-color 0.25s linear 0s;
}

to this:

main a:active, main a:focus, main a:hover, aside a:active, aside a:focus, aside a:hover {
    background-color: #ffffcc !important;
    border-bottom: 1px solid #ccc;
    border-radius: 5px;
    border-top: 1px solid #ddd;
    color: #bf1722;
    outline: medium none;
}
main a:link, main a:visited, aside a:link, aside a:visited {
    color: #20399d;
    outline: 0 none;
    transition: background-color 0.25s linear 0s;
}

Visually when you're tabbing through I like how it zooms. It might get tiring after a while, but it's gives direction as to where to look for the next link which is quite useful.

emma.maria’s picture

@mgifford This issue has unfortunately sat here for some time. Is there any chance you can update on what needs to still be completed or the direction to head in? I believe this issue is important :)

mgifford’s picture

Issue tags: +Usability

Hi @emma.maria - ultimately it's about getting support for the design concept. Then we can hammer out what actually gets implemented.

I think if we added some of the visual elements that http://webaim.org has built into their site for both mouse & keyboard only users that it would be a great example for other sites to follow. I think it just adds a nice usability layer even if you don't have a disability.

For sighted keyboard only users I think it is important though to style the link on focus so that it is easier for the user to know where they are on the page.

If for D8.0 we could just agree on how we want that styled it would be great. D7 already brought ahead the skip-link behaviour. We'd just need need to agree on a simple design for keyboard only users which would complement Bartik.

Any suggestions?

mgifford’s picture

Interesting to see Keyboard, Mouse & Touch highlighted in http://ten1seven.github.io/what-input/

I do think that this is a good pattern to look at to see that the links & forms are easy to see. More info:
https://github.com/ten1seven/what-input

mgifford’s picture

Issue tags: +keyboard focus

Just tagging.

emma.maria’s picture

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

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.

mgifford’s picture

StatusFileSize
new302.61 KB

Nice to see a good solution practiced by the UK's GDS in their blog.

screenshot of GDS blog

Just using:

a:focus {
    background: #ffbf47;
    outline: 3px solid #ffbf47;
    outline-offset: 0;
}

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.

helenasue’s picture

Would it help solve the design argument if these focus states were constrained to only when focus is generated via the keyboard and not briefly on click?

I worked with a client who did NOT want focus states when mouse users interacted with elements, so we coded up a small solution that made focus state indicators only appear when accessed via the keyboard. This might be less disruptive to designs while still being useful to the people that this feature would primarily be for.

mgifford’s picture

I hadn't noticed that when clicking on the links. Thanks for drawing that to my attention. That's a strange browser patter.

I verified it here https://governmenttechnology.blog.gov.uk/2016/12/14/our-commitment-to-be...

andrewmacpherson’s picture

Seeing focus styles after clicking links is normal behaviour. Clicking moves the focus to the link, in the same way that clicking a text input moves the focus to the input.

Often you don't notice a focus style after a click, because a site has suppressed the default focus style, and used the same style for both :hover, :focus selectors. So first you move your pointer over the link, and get the :hover style. When you click it, and leave your pointer where it is, the link gains focus, and you get both the :hover and :focus styles. If these happen to be identical then you won't notice that the link gained focus by clicking it. Half a second later you're rendering a new page.

I don't think Drupal core should try to suppress focus indicators for pointer users. Pointer users benefit from focus indicators too - they provide feedback that the thing that has just been clicked was the intended thing. That's useful for small targets which are near each other, like breadcrumbs, pagination, media player buttons, or the small dropdown from Drupal's Contextual Links.

...solution that made focus state indicators only appear when accessed via the keyboard

If there was a reliable way to tell them apart, like a well maintained third-party JS library, then we could provide stronger focus styles for keyboard users, and leave subtler ones in place for pointer users. I just don't like the idea of suppressing focus styles completely for pointer users.

:active styles are something we could consider, to provide strong feedback that the correct link was clicked, but this style only lasts during the mouse click itself. There's a strong demo at MDN :active.

helenasue’s picture

Sorry @andrewmacpherson, I think I was unclear. I wasn't saying that we should suppress or remove focus states for mouse users - I meant that we could make a distinct set of focus indicators that are specifically for individuals who are keyboard users who may need a more prominent focus indicator without disrupting the ordinary focus indicator that is themed in for traditional users, like you're suggesting. My script does just that. :)

andrewmacpherson’s picture

#34 - Yes, I like the sound of that explanation better! Is your script available to play with on Github, or somehwere? I think I've heard of some other similar scripts, but I can't remember the names, or whether they required jQuery, etc.

So the idea goes: Likely keyboard user detected... activate the enhanced focus styles!

Does it activate after any keyboard events, or do something clever like wait looking for tab/enter/spacebar/arrows?

andrewmacpherson’s picture

I found this mention of focus outlines in the HTML 5.1 recommendation, in section 5.4.6 focus management APIs (emphasis mine):

Do not use this method to hide the focus ring if you find the focus ring unsightly. Instead, use a CSS rule to override the outline property, and provide a different way to show what element is focused. Be aware that if an alternative focusing style isn’t made available, the page will be significantly less usable for people who primarily navigate pages using a keyboard, or those with reduced vision who use focus outlines to help them navigate the page.

This says that focus styles do not solely benefit keyboard-only users, but it doesn't offer much explanation. What personas might this refer to?

helenasue’s picture

Awesome! I haven't posted it on GitHub, but here's a preview. I'm using that to do some demo styles, but we can always fiddle with those once I put the patch up.

  /**
   * Accessibility - Make focus styles exclusive to keyboard by adding a
    * class to exclude focus styles from when focused via mouse
   */
  Drupal.behaviors.keyboardFocusStyles = {
    attach: function (context, settings) {
      $('body', context).on('mousedown', '*', function(e) {
        if (($(this).is(':focus') || $(this).is(e.target))) {
          $(this).closest('a').addClass('js-mouse-focus');
        }
      });
      $('body', context).on('focusout', '*', function(e) {
        $(this).closest('a').removeClass('js-mouse-focus');
      });
    }
  }
andrewmacpherson’s picture

Title: Add focus styling to all elements » Add focus styling to all interactive elements

There's a lot of interesting discussion in the comments at Stop Messing with the Browser's Default Focus outline, including an old one I made then forgot about.

This comment from PatanjaliS is an interesting reminder not to treat mouse and keyboard users as distinct groups (emphasis mine):

Keyboard and mouse use are not necessarily mutually exclusive, and may be freely interchanged between, depending upon what input method was being used just before considering which to use next.
Having a visible focus, even if accessed by a mouse, indicates that the next field can be accessed by using the Tab key, which may make more sense to use if you had just typed in text, rather than the delay of going to the mouse just to change field when you are going to go back to using a keyboard anyway.

helenasue’s picture

I agree with you about needing a focus indicator of some kind for both groups, but I do think that there's a certain amount of practicality to having distinct styles for each. Design and accessibility are often at odds with one another, since the very noticeable styling that is ideal for accessibility often isn't loved by designers, as the current trends are all about subtly. By isolating the focus states by mode of access we can give 'traditional' users an experience that won't start a war with those who prioritize design while still giving those who need something more attention-grabbing what they need.

helenasue’s picture

Also, I get it about using the browser's default outline - it's usually not best practice to override browser styles. However, there are situations where there is a case for it to be made.

For instance, the blue outline isn't great on Bartik because the header region is already almost exactly the same color. There's not enough contrast there to benefit a low-vision user.

helenasue’s picture

Here's what I've got so far. The styling may not be ideal since I'm not a designer, but it's in place to demonstrate potential functionality.

andrewmacpherson’s picture

@helenasue That's cool, I'll give it a proper manual test soon.

We probably want to move forward by reviewing our current focus styles, and designing new ones where we find they are missing (or poor). I don't think a consensus was formed in the early comments (before #23 in June 2015).

Adding this JS library should probably wait until we've designed the keyboard-specific focus styles. (Maybe it will be a child issue.)

Meanwhile, a quick skim-read of the patch from #41 revealed this. Looks like an unintended change:

-  background: url(../../../../misc/feed.svg) no-repeat;
+  background: url(../../../../misc/feed.svg) no-repeat center center;

I like the general look of keyboard-a11y.js file. It seems lean enough, but someone with better javascript knowledge should review that. The behaviour is called keyboardFocusStyles but it works by excluding mouse actions. I wonder what we should do about other interactions like touch and stylus pointers? Maybe we should detect keyboard events instead?

keyboard-a11y.js should probably become a core system library (in core/misc) so any theme could use it. The focus CSS would live in Bartik and Seven, I think.

I've just noticed ten1seven/what-input which @mgifford mentioned back in #25. It's had releases this year and seems actively maintained. Worth a detailed comparison.

helenasue’s picture

Thanks!

I agree, this shouldn't go in without further design first. I put it up to demonstrate how such a thing could theoretically work, but it's not ideally styled in its current state. I also agree that in retrospect I should have named it something more indicative of what it actually does rather than its ultimate purpose.

The 'center center' wasn't accidental, however - icons look better with a focus state applied when they are centered in their element. It makes the background or outline not off-center.

I'd be plenty happy for that to become a system library instead so that it can be used across the themes. I'm not sure about what-input, since I haven't used it or tested it, but I'm open to exploring that as an alternative. I only suggested my script because I've battle-tested it on client projects in the past successfully.

Bojhan’s picture

I am a bit worried, we might be making Bartik less pretty across the board with "one" focus style. Can we adapt and only provide focus styles where the "browser default" style might collide with existing styles (e.g. focus blue on blue background) albeit this is browser dependant.

andrewmacpherson’s picture

a11y.js is another JS library which distinguishes whether the source of a focus event was keyboard or pointer. It provides ally.style.focusSource() method, and maintains a <html data-focus-source="key"> attribute for CSS use. Does not have a jQuery dependency :-)

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.

mgifford’s picture

@Bohan, I don't that that solution would hit the usability / accessibility challenges of not having links. As Terrill says:

"Since the dawning of the Web, browsers have underlined links so users could distinguish link text from surrounding text. In fact, all major browsers still do this by default. Ever wonder why? Answer: Because it continues to be an effective way to communicate 'this is a link'."

- http://terrillthompson.com/blog/830

Wired has gone this way.

@andrewmacpherson How do you think we can best make use of ally.js?

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.

mgifford’s picture

Issue tags: +wcag21

Not sure if this WCAG 2.1 guideline applies here, but useful to think about for other "keyboard focus" issues https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus

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.

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
Status: Needs work » Postponed (maintainer needs more info)
StatusFileSize
new27.29 KB

Moving this to contrib since Bartik was removed from core in D10. But I am also marking it postponed because I am not sure whether it still needs to be actioned. Testing Bartik with D10, there is a clear focus style for each element.

Also tested Olivero just in case it still needed to be handled by core, but unsurprisingly it is well handled there too. So this issue may be obsolete.

mgifford’s picture

Here is some documentation around this from the GDS https://design-system.service.gov.uk/get-started/focus-states/

mgifford’s picture

Status: Postponed (maintainer needs more info) » Needs work

@pameeela I'm moving this back to Needs work, with a clarification. Using the default browser focus/outline is ok. But if you look at the keyboard focus state examples above, you can see that the default looks weak by comparison. It's even hard to read "tag2" because the blue line is so close around that.

It's just much less pronounced and less designed as it is now. It just looks like an afterthought letting the browser determine this. It would be more clearly an accessible theme if the focus styling was considered and aligned with the rest of the look/feel of the core Drupal themes.

Just closing another issue and bringing forward this comment from that thread:
https://www.drupal.org/project/drupal/issues/2942487#comment-12645241

Outline it's default styles to mark link or any interactive element as focused (for major browsers). Advantage of outline that it can be added not only for links but for other elements and styles will be consistence. Plus it's possible to adjust outline color according to styleguide. And practice shows that best way to highlight focused items its to use outline, its more visually noticeable. Underline and color change its also good practice but its can be added as additional to outline.