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

chore: Underline styles for popover text trigger #3060

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

georgylobko
Copy link
Contributor

@georgylobko georgylobko commented Nov 26, 2024

Description

AWSUI-59855
Replaced border bottom with underline dotted styles.

Related links, issue #, if available: n/a

How has this been tested?

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 Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.42%. Comparing base (372abbd) to head (c5fc150).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3060    +/-   ##
========================================
  Coverage   96.42%   96.42%            
========================================
  Files         787      787            
  Lines       22191    22191            
  Branches     7555     7209   -346     
========================================
  Hits        21398    21398            
- Misses        741      786    +45     
+ Partials       52        7    -45     

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

@georgylobko georgylobko marked this pull request as ready for review December 2, 2024 13:18
@georgylobko georgylobko requested a review from a team as a code owner December 2, 2024 13:18
@georgylobko georgylobko requested review from michaeldowseza and removed request for a team December 2, 2024 13:18
@michaeldowseza
Copy link
Member

Are all visual differences to be expected from this? e.g. Slight change in dotted line + slight shift in where the popover appears from?

image

Copy link
Contributor Author

@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.

@michaeldowseza
I’ve addressed this discrepancy and reviewed the screenshot tests in my dev pipeline. Everything looks good now.

Copy link
Contributor Author

@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.

Posting all main diffs with live (upd 16.01.2025):

live:
image
current (underline applies only to the text, not to the icon):
image

live:
image
current (multi-line underline, which is the whole point of this PR):
image

@@ -12,6 +12,14 @@
@import './container';
@import './motion';

$trigger-underline-offset: 0.25em;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

0.25 is used instead of 0.2 because an underline at 0.2 overlaps with the text

…n the trigger and the bottom-positioned popover
}

/* stylelint-disable selector-combinator-disallowed-list, selector-max-type, selector-max-universal */
& span {
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to add a span for both in-place and portal variants of the popover to avoid the condition in styles?

I also see no reason to violate the stylelint rules: you can add a class name to the span element and target it directly.

Copy link
Contributor Author

@georgylobko georgylobko Jan 16, 2025

Choose a reason for hiding this comment

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

Unfortunately, that is not a case, because the styles are applied when we are dealing with 'external' component which we have no control over. See the example below:

<Popover
  size="medium"
  position="right"
  header="Memory error"
  content={<DynamicContent />}
  dismissAriaLabel="Close"
  renderWithPortal={renderWithPortal}
>
   <StatusIndicator type="error">Error</StatusIndicator>
</Popover>

The current implementation applies border styles directly to the popover trigger, which is a block element, while underline styles are not inherited down the block elements, only for inline elements. Therefore, I realized that the only way to apply the styles to the block element is by using this selector.

Copy link
Member

Choose a reason for hiding this comment

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

What if the nested element is not a span?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this change specifically applies to text type of triggers, I think it's a reasonable assumption that only span elements will be used. This code specifically targets our components and use cases. If something doesn't work well for users, they always have the option to introduce a custom trigger

@georgylobko georgylobko requested a review from pan-kot January 16, 2025 10:44
line-height: calc(1 + #{$trigger-underline-offset} + #{awsui.$border-divider-list-width});
}

/* stylelint-disable selector-combinator-disallowed-list, selector-max-type, selector-max-universal */
Copy link
Member

Choose a reason for hiding this comment

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

I would add a code comment explaining that the combinator actually targets the custom content

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.

3 participants