Skip to content

fix: Use inset border for highlighting selected items in select and multiselect #3486

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

avinashbot
Copy link
Member

@avinashbot avinashbot commented May 9, 2025

Description

A selectable item border has two states: selected (the item is selected - blue border), highlighted (the element is currently hovered over or navigated to - black/grey border). The trouble is that we don't have a 3:1 contrast between the two, so if you highlight a previously selected item, the difference in color isn't enough to be perceivable. And it's worth noting that both those colors should also have a 3:1 contrast against the background too.

There were no good options when Atsushi and I were playing around with colors, so instead, we decided to do a double outline approach. Two borders to communicate two states; they're still not 3:1 against each other, but they're both independently 3:1 against the background, and also results in a double-width border which is also perceivable (as long as it's at least 2px).

Related links, issue #, if available: AWSUI-60235

How has this been tested?

Screenshot testing. My pipeline's busy, will try to procure someone else's pipeline to send it through.

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

codecov bot commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.49%. Comparing base (5024307) to head (52f7f88).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3486    +/-   ##
========================================
  Coverage   96.49%   96.49%            
========================================
  Files         804      804            
  Lines       23090    23090            
  Branches     7587     8000   +413     
========================================
  Hits        22281    22281            
  Misses        802      802            
  Partials        7        7            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +71 to +76
&.is-keyboard {
border-color: awsui.$color-border-dropdown-item-focused;
&:not(.visual-refresh) {
box-shadow: inset 0 0 0 awsui.$border-control-focus-ring-shadow-spread awsui.$color-border-item-focused;
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Just moved this chunk up from below because it made more logical sense here.

@@ -80,8 +86,21 @@
border-end-end-radius: 0;
}
&.highlighted {
border-color: awsui.$color-border-dropdown-item-hover;
z-index: 3;
border-color: awsui.$color-border-dropdown-item-selected;
Copy link
Member Author

Choose a reason for hiding this comment

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

The hover/focus styling inside a selected item is displayed using an outline. So the border-color should remain the selected color.

@avinashbot avinashbot force-pushed the selected-highlighted-focus-ring branch from c2319f4 to 52f7f88 Compare May 9, 2025 11:31
@avinashbot avinashbot marked this pull request as ready for review May 12, 2025 08:44
@avinashbot avinashbot requested a review from a team as a code owner May 12, 2025 08:44
@avinashbot avinashbot requested review from georgylobko and removed request for a team May 12, 2025 08:44
Copy link
Member

@georgylobko georgylobko left a comment

Choose a reason for hiding this comment

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

in overall looks good. Did you try to run these changes in your dev pipeline?

@avinashbot
Copy link
Member Author

@georgylobko Going through now, won't merge until they have!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants