owncloud / owncloud-design-system

:art: A pattern library for ownCloud for Vue.js
https://owncloud.design
Apache License 2.0
26 stars 19 forks source link

Focus states need to be more prominent #445

Open LukasHirt opened 5 years ago

LukasHirt commented 5 years ago

Description

Focus styles of all buttons, checkboxes, links does only slightly differ from the normal state - often times it is not obvious which piece of interface has focus

marcus-herrmann commented 5 years ago

Problem (abstract)

It is hard to differentiate the normal state from the focus state. The color contrasts of the border colors of the normal and focus-state don't differ enough.

Solution (abstract)

* By WCAG Success Criteria 1.4.11 (here's the official explainer document)

Solution in phoenix

Like with most color related issues this isn't a development/code issue alone, it has to be coordinated with a visual design department possibly (and also theming must be taken into consideration). Nevertheless my suggestion for a focus style adhering to the points above would be (simplified code):

.oc-button:focus {
  border-color: #002966;
  box-shadow: inset 0px 0px 0px 1px #002966;
}
marcus-herrmann commented 4 years ago

@PVince81 @LukasHirt

As agreed upon at the sprint planning meeting last monday, here's my take/proposal on much more prominent focus styles, and then show it to @wuenschedesign and the team to gather feedback. I tried to stay inside the established color palette, while still sticking to the contrast ratios quoted above.

Take note:

See below several demo images and a short video of how I would subtly animate the focus.

Screenshot 2019-11-28 at 15 51 58 Screenshot 2019-11-28 at 15 51 45 Screenshot 2019-11-28 at 15 51 36 Screenshot 2019-11-28 at 15 51 24 Screenshot 2019-11-28 at 15 51 16 Screenshot 2019-11-28 at 15 51 09 Screenshot 2019-11-28 at 15 51 03 Screenshot 2019-11-28 at 15 50 51 Screenshot 2019-11-28 at 15 50 44 Screenshot 2019-11-28 at 15 52 12 Screenshot 2019-11-28 at 15 52 06

Here is the short video

wuenschedesign commented 4 years ago

The following drafts show the normal, hover, active, focus and disabled state of input fields and buttons.

Input Fields

Normal Vision Color Blindness Low Vision
Input-Fields-v01 Input-Fields-v01-with-color-blindness Input-Fields-v01-with-low-vision

Buttons

Normal Vision Color Blindness Low Vision
Buttons-v01 Buttons-v01-with-color-blindness Buttons-v01-with-low-vision
wuenschedesign commented 4 years ago

List View with marked Focus States of various elements in the UI:

List-View-States

wuenschedesign commented 4 years ago

@PVince81 @DeepDiver1975 @LukasHirt : I need some feedback, how a focus state must be implemented, e. g. does an additional border change the dimension of an element/button and thus makes a UI „jump“?

marcus-herrmann commented 4 years ago

@wuenschedesign In my "prototyping" for the screenshots above I used CSS properties outline and box-shadow to prevent jumping. There is no hard rule how these styles must be implemented (only regarding visual styling). I prototyped not all possible interactive elements for the demo, only the ones pictured above. But I reckon jumping can be prevented with these measures in general.

wuenschedesign commented 4 years ago

How does a box shadow work with icons (free form as an outline)? Is the shadow applied to the trimbox of the icon or the free form? Is this trimbox always equal to the touch target of an UI item?

Focus-State-Box-Shadow

marcus-herrmann commented 4 years ago

@wuenschedesign I'm not familiar with the term trimbox, but I guess that is the answer. Like in my demos above, I used box-shadow not for a realistic drop shadow but for a rectangular border that is not part of the CSS box model, therefore preventing a jump (these jumps are at the amount of the "width" of the border, but even noticable when its 1px. Thus: "outline" with box shadow, or where possible, with CSS's outline)

wuenschedesign commented 4 years ago

A preliminary draft to show the status of controls, checkboxes, toggleswitches. Probably there’s no need for a hover or disabled state In certain cases (Making an option invisible instead of turning it to disabled status).

Checkboxes-Toggle-Switches

marcus-herrmann commented 4 years ago

@wuenschedesign In my opinion on some items like the favorite star the visual difference between normal and focussed is way too subtle. In some regards it is as un-prominent as the current state in Phoenix.

One info: It is technically possible to restrict the focus styles to keyboard/non-pointer usage alone (:focus-visible in CSS), therefore a user with a pointing device (touch, mouse) won't ever get a focus style, even when they set the control focussed after click (that unwanted effect is the main reason that focus styles get removed in the first place).

So my recommendation is: You can/should be way more bold and obvious with the focus styles (see my demos).