Problem/Motivation

We implemented the text field before the introduction of the green focus ring so it has its own custom focus effect which is much less visible than the green focus ring.

Proposed resolution

Add the green focus ring to the text field element in the style guide and implement that in Claro.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

lauriii created an issue. See original summary.

ant1’s picture

Status: Active » Needs review
StatusFileSize
new616 bytes

I know this has yet to be changed in the style guide, but I created a patch which removes the old focus styling from form fields.
This way text fields will use the default focus style which looks correct in my opinion (compared to the focus style of ex. Select field).

A thing that came up when looking at the code is that checkboxes and radios also still have the old focus styling.
For addressing these fields I will create a new issue.

ant1’s picture

Assigned: Unassigned » ant1
Status: Needs review » Needs work
ant1’s picture

Assigned: ant1 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.71 KB
new1.53 KB

Added :active, :focus:active and :focus:hover styling (same approach as the Select field).

lauriii’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new6.99 KB

Loading text is leg under the focus effect on autocomplete fields:

katrienc’s picture

StatusFileSize
new2.18 KB

Patch with changes from #4

I've also did a change on the loading text. I added a line-height to it and a small margin-bottom so the text became above the focus effect. (solve issue on #5)

katrienc’s picture

Status: Needs work » Needs review
katrienc’s picture

StatusFileSize
new2.18 KB

Ok, this patch should pass the test. Forgot to add a leading zero.

fhaeberle’s picture

Component: Needs design » Code
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new646 bytes
new646 bytes

This looks good! Added some size comments to clarify the rem calculation as we have done it in the other cases.
From my point of view: RTBC.

huzooka’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new32.1 KB
new16.47 KB

Issues I've found after a fast visual review:

  1. Text inputs with errors do not have the focus ring when they're focused (but not hovered).
  2. If an input with error is focused AND hovered, its border gets half red and half black.

katrienc’s picture

Assigned: Unassigned » katrienc
katrienc’s picture

Assigned: katrienc » Unassigned
Status: Needs work » Needs review
StatusFileSize
new143.06 KB
new2.62 KB
new1.83 KB

I've changed the behaviour. The issues described in #10 should been solved.

It looks now like this:

focus input element

In the design specs I didn't found the behaviour what should happen when you hover an error input element

Normal input element:
- border black and really thin
- hover: border is a black but thicker

Input element with error:
- border red and thick
- hover: no different in thickness

Is this correct? I should espect that the input element with error should have in non-hover state the same border thickness as the normal input element.

fhaeberle’s picture

Huh, actually I missed testing the error state, sorry!

Good catch! I think it's on purpose that the error states red border is thicker than the regular states black border because the thicker border on the error state has much more visibility and gets better recognition.

Imagining the red border would be the same thickness than the regular states black one would miss the needed recognition and would impair visibility.

Therefore, this is implemented correctly.

If you have questions in case of the Figma designs, the #admin-ui-design channel in drupal slack is extremely helpful to clarify things.

katrienc’s picture

Thanks for the feedback!

I've changed the height of the row so there's enough spacing for the loading text (24px like mentioned on #3023320 Entity Reference Style Update).

It looks now like this:

spacing between multiple fields

fhaeberle’s picture

fhaeberle’s picture

Thanks for the quick response and your work! I'm not sure if we should fix this bug (#14) in this issue so I asked in the related field cardinality issue.
For reviewers, the patch in #12 should be fine to test.

lauriii’s picture

StatusFileSize
new20.73 KB

The margin has been fixed in the design system:

lauriii’s picture

Status: Needs review » Needs work
+++ b/css/src/components/tabledrag.css
@@ -33,6 +33,13 @@ body.drag {
+/**
+ * Draggable row sufficiently high enough for loading text purposes on autocomplete input elements
+ **/
+.draggable {
+  height: 6rem;
+}

This should be only applied to autocomplete table drag. I'm wondering if this could be done in the .claro-autocomplete styles instead?

katrienc’s picture

StatusFileSize
new2.69 KB

Indeed, it should be on the autocomplete styles.
I've removed it from tabledrag and added a margin top and bottom to the autocomplete style:

.claro-autocomplete {
  display: inline-block;
  position: relative;
  max-width: 100%;
  margin: 0.5rem 0;
}
katrienc’s picture

Status: Needs work » Needs review
fhaeberle’s picture

@lot007 Thanks! Setting to needs review because of the patch.

fhaeberle’s picture

Status: Needs review » Needs work

This looks good! But I'm wondering, did we already take comment #17 into account?

ant1’s picture

Assigned: Unassigned » ant1

The spacing has been taken into account in the latest patch, but I believe the distance does not correspond with the one set in the design (it results in 28px instead of 24px).

I'll create a new patch adjusting this value.

ant1’s picture

Assigned: ant1 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new492 bytes
new2.69 KB

Spacing has been adjusted.

lauriii’s picture

+++ b/css/src/components/form--text.css
@@ -53,6 +53,22 @@
+.form-element:focus:active {
+  box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 var(--input-border-size) var(--input--focus-border-color);
+}
...
+.form-element:focus:hover {
+  box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 var(--input-border-size) var(--input--hover-border-color);
+}

Couldn't these be defined just as single .form-element:focus rule?

ant1’s picture

I believe it is not possible. It would overwrite the box-shadow value of .form-element:active & .form-element:hover.

As it is in #24:
Hovered & focused text field before supposed changes

If I combine them (without adding an inset, both states have a different border-color):
Hovered & focused text field after supposed changes

lauriii’s picture

StatusFileSize
new2.92 KB
new2.31 KB

Any thoughts on using borders for styling the effect when possible? Here's patch as a proposal.

huzooka’s picture

Checking this.

huzooka’s picture

Status: Needs review » Needs work
StatusFileSize
new95.29 KB
+++ b/css/src/components/form--text.css
@@ -55,27 +55,33 @@
+  border-width: var(--input--error-border-size);

This increases the visual border of the text editor to 3px. Even though we have a separate issue to update the styles for the editor, I think it is better not changing it here. Please remove this line!

huzooka’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new2.87 KB
new440 bytes

Good catch! Fixed!

huzooka’s picture

Status: Needs review » Reviewed & tested by the community

This is fine!

  • lauriii committed 33fd701 on 8.x-2.x
    Issue #3054689 by lot007, AntoineH, lauriii, huzooka, fhaeberle:...

  • lauriii committed b743c84 on 8.x-1.x
    Issue #3054689 by lot007, AntoineH, lauriii, huzooka, fhaeberle:...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Thank you all! Committed and pushed! 🚀

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.