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: adding tooltips and tests to visual-refresh-toolbar #2650

Merged
merged 39 commits into from
Sep 19, 2024

Conversation

dpitcock
Copy link
Member

@dpitcock dpitcock commented Sep 3, 2024

This adds a visual tooltip to the toolbar on visual-refresh-toolbar variant by adding event listeners to the toolbar-trigger-wrapper elements that shows the tooltip when focused or hovered.

Screenshot 2024-09-09 at 10 59 58

Description

The trigger-button takes new props to determine if a tooltip should be possible.

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? Y
  • Changes are covered with new/existing integration tests? Y

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 Sep 3, 2024

Codecov Report

Attention: Patch coverage is 97.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.91%. Comparing base (093fdc0) to head (33d1e1f).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...l-refresh-toolbar/toolbar/trigger-button/index.tsx 97.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2650      +/-   ##
==========================================
+ Coverage   95.90%   95.91%   +0.01%     
==========================================
  Files         748      748              
  Lines       20732    20814      +82     
  Branches     7059     6720     -339     
==========================================
+ Hits        19882    19963      +81     
- Misses        794      843      +49     
+ Partials       56        8      -48     

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

@dpitcock dpitcock force-pushed the denpitco-toolbar-trigger-tooltip2 branch from ce09c55 to 3ca3174 Compare September 3, 2024 11:56
@dpitcock dpitcock force-pushed the denpitco-toolbar-trigger-tooltip2 branch from 3ca3174 to e040c49 Compare September 3, 2024 12:45
@dpitcock dpitcock marked this pull request as ready for review September 3, 2024 13:08
@dpitcock dpitcock requested a review from a team as a code owner September 3, 2024 13:08
@dpitcock dpitcock requested review from jperals and removed request for a team September 3, 2024 13:08
package-lock.json Outdated Show resolved Hide resolved
@jperals
Copy link
Member

jperals commented Sep 3, 2024

Note that if i blur and focus the browser again, I can get into a situation where multiple tooltips are visible:

Screenshot 2024-09-03 at 15 35 54

@dpitcock dpitcock changed the title feat: adding tooltips and tests to visual-refresh toolbar feat: adding tooltips and tests to visual-refresh Sep 4, 2024
@dpitcock dpitcock force-pushed the denpitco-toolbar-trigger-tooltip2 branch from e040c49 to d016767 Compare September 5, 2024 14:42
@dpitcock dpitcock changed the title feat: adding tooltips and tests to visual-refresh feat: adding tooltips and tests to visual-refresh & visual-refresh-toolbar Sep 5, 2024
@dpitcock dpitcock force-pushed the denpitco-toolbar-trigger-tooltip2 branch from d016767 to e41eb5a Compare September 6, 2024 08:27
@dpitcock dpitcock requested a review from jperals September 6, 2024 09:13
@dpitcock dpitcock force-pushed the denpitco-toolbar-trigger-tooltip2 branch from e41eb5a to 04307bf Compare September 6, 2024 09:18
@dpitcock dpitcock force-pushed the denpitco-toolbar-trigger-tooltip2 branch from 04307bf to fd038bc Compare September 9, 2024 08:33
*/
const handleOnFocus = useCallback(
(event: FocusEvent) => {
let shouldShowTooltip = false;
Copy link
Member

Choose a reason for hiding this comment

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

Minor: no need to declare a let, can be declared as const as it is assigned only once

Copy link
Member Author

@dpitcock dpitcock Sep 18, 2024

Choose a reason for hiding this comment

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

It gets modified though in the conditional below it

Copy link
Member

Choose a reason for hiding this comment

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

But it's the only place where it is assigned, so it could be declared just there. Anyway not blocking.

const relatedTarget = eventWithRelatedTarget?.relatedTarget;
const isFromAnotherTrigger = relatedTarget?.dataset?.shiftFocus === 'awsui-layout-drawer-trigger';
if (
isForSplitPanel || //for tab/key navigation to button from breadcrume
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: typo in comment (breadcrume)

Copy link
Member

Choose a reason for hiding this comment

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

Is it ever possible that isForSplitPanel and isForPreviousActiveDrawer are true at the same time? If not, there is no need to check for isForSplitPanel in this condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. when the split panel is open that both would be true

@dpitcock dpitcock added this pull request to the merge queue Sep 19, 2024
Merged via the queue into main with commit 661b396 Sep 19, 2024
33 checks passed
@dpitcock dpitcock deleted the denpitco-toolbar-trigger-tooltip2 branch September 19, 2024 07:49
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