Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add consistent keyboard focus ring across interactive components #2050

Conversation

RasmusKjeldgaard
Copy link
Collaborator

@RasmusKjeldgaard RasmusKjeldgaard commented Feb 16, 2022

Which issue does this PR close?

This PR closes #1863 closes #1944 closes #1744

What is the new behavior?

Two focus mixins has been created and used across most interactive components.
The two mixins and their differences should hopefully be explained by the comments in _focus.scss.
Accordion-item, item and tabs has been left out for now as they are still being refined.

Does this PR introduce a breaking change?

  • Yes
  • No

Are there any additional context?

Checklist:

The following tasks should be carried out in sequence in order to follow the process of contributing correctly.

Reminders

  • Make sure you have implemented tests following the guidelines in: "The good: Test".
  • Make sure you have updated the cookbook with examples and showcases (for bug fixes, enhancements & new components).

Review

  • Do a self-review.
  • Request that the changes are code-reviewed
  • Request that the changes are UX reviewed (only necessary if your PR introduces visual changes)

When the pull request has been approved it will be automatically merged to master via automerge.

@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 16, 2022 08:33 Inactive
@RasmusKjeldgaard RasmusKjeldgaard changed the title Enhancement/1863 desktop ready keyboard focus Add consistent keyboard focus ring across interactive components Feb 16, 2022
@RasmusKjeldgaard
Copy link
Collaborator Author

RasmusKjeldgaard commented Feb 16, 2022

⚠️ ⚠️ Right now, the merge target is the hover theme branch. This is only a placeholder until a new theme branch is created, possibly based on the hover interaction state theme. We need to figure out the timing between these two, so stay tuned 💯

@RasmusKjeldgaard RasmusKjeldgaard force-pushed the enhancement/1863-desktop-ready-keyboard-focus branch from fd71696 to 8461e68 Compare February 16, 2022 09:04
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 16, 2022 09:09 Inactive
@RasmusKjeldgaard RasmusKjeldgaard changed the base branch from main to release/theme/2028-button-attention-levels-and-hover February 16, 2022 09:23
@@ -31,7 +31,7 @@ $text-colors: (
'danger': #ee0d0d,
);

$focus-ring-color: rgb(77, 144, 254);
$focus-ring-color: rgb(34, 139, 236);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new focus color, as verified by @henrikvoetmand

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason this is declared with rgb()? The other color values are declared using hexadecimal. (It was probably not you who introduced this. I'm just curious 🙂)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, but changed it to hexadecimal.

@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 17, 2022 10:08 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 17, 2022 10:29 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 17, 2022 10:30 Inactive
@RasmusKjeldgaard RasmusKjeldgaard force-pushed the enhancement/1863-desktop-ready-keyboard-focus branch from 4745bfc to 74651f2 Compare February 17, 2022 17:09
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 17, 2022 17:15 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 23, 2022 11:03 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 24, 2022 12:21 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 24, 2022 15:03 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 28, 2022 06:46 Inactive
@@ -32,6 +33,10 @@
}
}
}
&.compact {
//TODO: verify if this is OK. It enables focus ring to not be cut off for first chip
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle this TODO. Probably a quick talk with @MadsBuchmann.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the status on this TODO?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, we'll move forward with this implementation!

@RasmusKjeldgaard RasmusKjeldgaard marked this pull request as ready for review February 28, 2022 07:26
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus February 28, 2022 07:33 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus March 7, 2022 15:40 Inactive
Copy link
Collaborator

@jkaltoft jkaltoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all great work!

I added a lot of comments, but they're mostly minor things.

👍🏻 I like the Sassdoc style comments. We should extend our usage of it.

@@ -32,6 +33,10 @@
}
}
}
&.compact {
//TODO: verify if this is OK. It enables focus ring to not be cut off for first chip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the status on this TODO?

ion-toggle {
@include interaction-state.apply-focus-part($part: 'track');
overflow: visible;
contain: none;
Copy link
Collaborator

@jkaltoft jkaltoft Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not completely comfortable with CSS Containment, yet. Maybe it's just me being ignorant, but I'd appreciate a short comment on why we need the contain: none declaration.

And just for all intents and purposes, did you verify that browser adaptation of CSS Containment is ok?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment to clarify this.

@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus March 9, 2022 11:18 Inactive
@github-actions github-actions bot temporarily deployed to pr-1863-desktop-ready-keyboard-focus March 9, 2022 12:44 Inactive
@RasmusKjeldgaard RasmusKjeldgaard force-pushed the enhancement/1863-desktop-ready-keyboard-focus branch from 3bf5f49 to 9a823dc Compare March 9, 2022 13:09
@RasmusKjeldgaard
Copy link
Collaborator Author

@jkaltoft and I agreed today that we should merge this to the existing hover theme, so all this can be tested and released together.

Copy link
Collaborator

@jkaltoft jkaltoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

giphub

giphub

@RasmusKjeldgaard RasmusKjeldgaard merged commit 0c095e9 into release/theme/2028-button-attention-levels-and-hover Mar 9, 2022
@RasmusKjeldgaard RasmusKjeldgaard deleted the enhancement/1863-desktop-ready-keyboard-focus branch March 9, 2022 13:46
jkaltoft pushed a commit that referenced this pull request Mar 14, 2022
* 💄 Apply focus-within to button

* 💄 Fix checkbox border radius assignment

* 💄 Apply focus-within to checkbox

* 💄 Apply focus-within to radio

* 💄 Apply focus-within to toggle

* 💄 Change global focus ring color

* 💄 Apply focus-within to card

* 💄 Apply focus-within to dropdown

* 💄 Apply focus-within to input (formfield)

* 💄 Apply focus-within to textarea (formfield)

* 💄 Apply focus-within to link

* 💄 Apply focus-within to knob in range

* 💄 Specify padding on segment btn (closes #1744)

This is a prerequisite for properly styling the segment button with a
focus ring

* 💄 Apply focus-within to segmented-control

* 💄 Use element-as-button directive with chip

* 💄 Apply focus-within to chip

* 🚧  Remove outline test from elm as btn directive

This is part of restructuring focus ring tests. It is the responsibility
of components themselves not this directive to apply focus styling.

* 💄 Introduce apply-focus mixin

* 💄 Use interaction state in button

* 💄 Extend apply-focus mixin with gap and shadow

* 💄 Use apply-focus in card

* 💄 Use apply-focus in link

* ⏪  Revert accidental color change

* ♻️  Remove accidental double pseudo class for link

* 💄 Adjust link focus ring border radius

* 💄 Use background color getter from utils

* 💄 Use apply-focus in dropdown

* 💄 Split mixin in two to support css shadow parts

* 💄 QoL improvements to focus mixin

* 💄 Use apply-focus-part in toggle

* ♻️  Clean up link, card and dropdown

* 💄 Fix missing string interpolation

* ♻️  Move apply-focus to shared form field styles

* 💄 Use apply-focus in checkbox

* 💄 Use apply-focus in chip

* 💄 Use apply-focus in radio

* 💄 Use apply-focus in range

* 💄 Use apply-focus in segmented-control

* 💄 Use apply-focus-part in Segmented Control

* 💄 Support elevation of four in card

* 💄 Add focus-visible mixin with fallbacks

* 💄 Replace apply-focus with focus-visible solution

* 💄 Apply mixins only on non-touch devices

* ♻️  Refactor navbar to leave room for focus ring

* 💄 Document and cleanup focus mixins

* 🎨  Formatting to improve readability

* Remove typo in focus mixin comment

* ♻️ Add content-block to mixin

* ♻️ Reorder imports alphabetically

* ♻️  Use focus-ring-color variable via utils

* 📝  Update comments for focus to be more specific

* ♻️ Document toggle style changes

* ♻️ Reorder for clarity

* 🔥 Remove todo
jkaltoft pushed a commit that referenced this pull request Mar 17, 2022
* 💄 Apply focus-within to button

* 💄 Fix checkbox border radius assignment

* 💄 Apply focus-within to checkbox

* 💄 Apply focus-within to radio

* 💄 Apply focus-within to toggle

* 💄 Change global focus ring color

* 💄 Apply focus-within to card

* 💄 Apply focus-within to dropdown

* 💄 Apply focus-within to input (formfield)

* 💄 Apply focus-within to textarea (formfield)

* 💄 Apply focus-within to link

* 💄 Apply focus-within to knob in range

* 💄 Specify padding on segment btn (closes #1744)

This is a prerequisite for properly styling the segment button with a
focus ring

* 💄 Apply focus-within to segmented-control

* 💄 Use element-as-button directive with chip

* 💄 Apply focus-within to chip

* 🚧  Remove outline test from elm as btn directive

This is part of restructuring focus ring tests. It is the responsibility
of components themselves not this directive to apply focus styling.

* 💄 Introduce apply-focus mixin

* 💄 Use interaction state in button

* 💄 Extend apply-focus mixin with gap and shadow

* 💄 Use apply-focus in card

* 💄 Use apply-focus in link

* ⏪  Revert accidental color change

* ♻️  Remove accidental double pseudo class for link

* 💄 Adjust link focus ring border radius

* 💄 Use background color getter from utils

* 💄 Use apply-focus in dropdown

* 💄 Split mixin in two to support css shadow parts

* 💄 QoL improvements to focus mixin

* 💄 Use apply-focus-part in toggle

* ♻️  Clean up link, card and dropdown

* 💄 Fix missing string interpolation

* ♻️  Move apply-focus to shared form field styles

* 💄 Use apply-focus in checkbox

* 💄 Use apply-focus in chip

* 💄 Use apply-focus in radio

* 💄 Use apply-focus in range

* 💄 Use apply-focus in segmented-control

* 💄 Use apply-focus-part in Segmented Control

* 💄 Support elevation of four in card

* 💄 Add focus-visible mixin with fallbacks

* 💄 Replace apply-focus with focus-visible solution

* 💄 Apply mixins only on non-touch devices

* ♻️  Refactor navbar to leave room for focus ring

* 💄 Document and cleanup focus mixins

* 🎨  Formatting to improve readability

* Remove typo in focus mixin comment

* ♻️ Add content-block to mixin

* ♻️ Reorder imports alphabetically

* ♻️  Use focus-ring-color variable via utils

* 📝  Update comments for focus to be more specific

* ♻️ Document toggle style changes

* ♻️ Reorder for clarity

* 🔥 Remove todo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants