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

feat: Show popover on truncated breadcrumb text #527

Merged
merged 13 commits into from
Nov 29, 2022

Conversation

YueyingLu
Copy link
Member

Description

Show popover on focus/hover on truncated text in breadcrumb.
Dismiss popover on blur/mouseleave/escape.

Related links, issue AWSUI-19121

How has this been tested?

Added integration test.
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.

@YueyingLu YueyingLu changed the title Breadcrumb title popover feat: Show popover on truncated breadcrumb text Nov 24, 2022
@codecov
Copy link

codecov bot commented Nov 24, 2022

Codecov Report

Base: 92.52% // Head: 92.38% // Decreases project coverage by -0.14% ⚠️

Coverage data is based on head (43ce9e9) compared to base (5648d1e).
Patch coverage: 29.41% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #527      +/-   ##
==========================================
- Coverage   92.52%   92.38%   -0.15%     
==========================================
  Files         567      569       +2     
  Lines       16134    16218      +84     
  Branches     4414     4433      +19     
==========================================
+ Hits        14928    14983      +55     
- Misses       1126     1151      +25     
- Partials       80       84       +4     
Impacted Files Coverage Δ
src/breadcrumb-group/item/item.tsx 42.85% <28.00%> (-57.15%) ⬇️
src/breadcrumb-group/internal.tsx 90.47% <100.00%> (+0.23%) ⬆️
src/pie-chart/pie-chart.tsx 77.70% <0.00%> (-0.44%) ⬇️
src/mixed-line-bar-chart/chart-container.tsx 90.50% <0.00%> (-0.23%) ⬇️
src/area-chart/model/use-chart-model.ts 55.35% <0.00%> (-0.20%) ⬇️
src/popover/body.tsx 100.00% <0.00%> (ø)
src/wizard/index.tsx 100.00% <0.00%> (ø)
src/wizard/wizard-form.tsx 100.00% <0.00%> (ø)
src/area-chart/internal.tsx 100.00% <0.00%> (ø)
src/attribute-editor/row.tsx 100.00% <0.00%> (ø)
... and 14 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@YueyingLu YueyingLu marked this pull request as ready for review November 24, 2022 21:46
@YueyingLu YueyingLu requested a review from a team as a code owner November 24, 2022 21:46
@YueyingLu YueyingLu requested review from timogasda and removed request for a team November 24, 2022 21:46
@YueyingLu YueyingLu requested review from a team, rubencarvalho and Al-Dani and removed request for timogasda and a team November 28, 2022 10:19
src/breadcrumb-group/item/item.tsx Outdated Show resolved Hide resolved
@YueyingLu YueyingLu requested a review from Al-Dani November 29, 2022 10:10
src/breadcrumb-group/item/item.tsx Outdated Show resolved Hide resolved
src/breadcrumb-group/item/item.tsx Outdated Show resolved Hide resolved
src/breadcrumb-group/item/item.tsx Outdated Show resolved Hide resolved
@YueyingLu YueyingLu requested a review from just-boris November 29, 2022 11:43
if (!textWidth || !virtualTextRef || !virtualTextRef.current) {
return null;
}
const virtualTextWidth = virtualTextRef.current.getBoundingClientRect().width;
Copy link
Member

@just-boris just-boris Nov 29, 2022

Choose a reason for hiding this comment

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

This attempt to fix that comment (#527 (comment)) is a step backwards. Now the height is calculated on every render, not even on an effect update.

An expected implementation would be like this

onMouseEnter={() => isTruncated(textRef.current, virtualTextRef.current) && setShowPopover(true)}

This way the size check is only happening on the exact event and not anywhere else

Copy link
Member Author

Choose a reason for hiding this comment

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

Now I get it. Thank you so much for the example!

src/breadcrumb-group/item/styles.scss Show resolved Hide resolved
src/breadcrumb-group/internal.tsx Show resolved Hide resolved
@YueyingLu YueyingLu requested a review from just-boris November 29, 2022 13:06
@YueyingLu YueyingLu merged commit cc4db96 into main Nov 29, 2022
@YueyingLu YueyingLu deleted the breadcrumb-title-popover branch November 29, 2022 14:43
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