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

fix(action-menu): add a slot for Tooltip content #3488

Merged
merged 19 commits into from
Aug 2, 2023

Conversation

anishAdobe
Copy link
Contributor

Tooltip for ActionMenu

Description

Related issue(s)

#2916

Motivation and context

How has this been tested?

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@github-actions
Copy link

github-actions bot commented Jul 25, 2023

Tachometer results

Chrome

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 748 kB 242.21ms - 248.66ms - unsure 🔍
-2% - +2%
-5.08ms - +4.17ms
branch 740 kB 242.58ms - 249.20ms unsure 🔍
-2% - +2%
-4.17ms - +5.08ms
-
Firefox

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 748 kB 408.39ms - 441.17ms - unsure 🔍
-3% - +6%
-12.98ms - +26.82ms
branch 740 kB 406.57ms - 429.15ms unsure 🔍
-6% - +3%
-26.82ms - +12.98ms
-

@anishAdobe anishAdobe marked this pull request as ready for review July 26, 2023 06:23
@anishAdobe anishAdobe changed the title Users/anishr/actionmenu Feat: Tooltip for Action Menu Jul 26, 2023
@anishAdobe anishAdobe requested review from Westbrook and vjosyula July 26, 2023 06:26
@anishAdobe anishAdobe force-pushed the users/anishr/actionmenu branch from 64fd49b to e7aa92d Compare July 26, 2023 12:16
@anishAdobe anishAdobe changed the title Feat: Tooltip for Action Menu feat(action-menu): Tooltip for Action Menu Jul 26, 2023
@anishAdobe anishAdobe force-pushed the users/anishr/actionmenu branch from 55a6a17 to 004e735 Compare July 26, 2023 12:21
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

I need to discuss with the team available APIs here for uniformity across the project, but if this version is the right one then you'll be on a good path for this merge with these notes.

@@ -52,6 +54,9 @@ export const ActionMenuMarkup = ({
<sp-menu-divider></sp-menu-divider>
<sp-menu-item>Save Selection</sp-menu-item>
<sp-menu-item disabled>Make Work Path</sp-menu-item>
${tooltip_description
? html`<sp-tooltip slot='tooltip' self-managed placement=${tooltip_placement}>${tooltip_description}</sp-tooltip`
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no definition for <sp-tooltip> included in this file.

There's also a missing >.

@@ -114,6 +159,14 @@ iconOnly.args = {
visibleLabel: '',
};

export const tooltip_description_placement = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Convert these snake_case variables to camelCase to match the rest of the project.

packages/action-menu/src/ActionMenu.ts Show resolved Hide resolved
@anishAdobe anishAdobe requested a review from Westbrook July 27, 2023 05:57
@anishAdobe anishAdobe force-pushed the users/anishr/actionmenu branch 2 times, most recently from b4d01a0 to f92d3dc Compare August 1, 2023 09:58
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

Baring the notes in this review, we think this approach is the correct path forward.

Concerning the issues you experienced with Overlay V2, we see that as a feature that should be added to <sp-tooltip> in that context, and doesn't need to derail the work you are doing here.

packages/action-menu/README.md Show resolved Hide resolved

```html
<sp-action-menu
<sp-tooltip slot='tooltip' self-managed placement='bottom'>'Content'</sp-tooltip>`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<sp-tooltip slot='tooltip' self-managed placement='bottom'>'Content'</sp-tooltip>`
<sp-tooltip slot='tooltip' self-managed placement='bottom'>'Content'</sp-tooltip>

Tooltip in action menu can be added via a slot. It can be attached to action menu by adding <sp-action-menu> and giving various parameters (e.g. placement, content, etc) as needed.

```html
<sp-action-menu
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<sp-action-menu
<sp-action-menu>

@@ -114,6 +159,14 @@ iconOnly.args = {
visibleLabel: '',
};

export const tooltipDescriptionAndPlacement = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Please ship this story without a visible label.


## Adding tootip in action menu

Tooltip in action menu can be added via a slot. It can be attached to action menu by adding <sp-action-menu> and giving various parameters (e.g. placement, content, etc) as needed.
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem right.

@anishAdobe anishAdobe force-pushed the users/anishr/actionmenu branch from eb1486c to bfba140 Compare August 1, 2023 16:22
@@ -55,6 +56,7 @@ export class ActionMenu extends ObserveSlotText(PickerBase, 'label') {
<sp-icon-more class="icon"></sp-icon-more>
</slot>
<slot name="label" ?hidden=${!this.hasLabel}></slot>
<slot name="tooltip" ?hidden=${this.open}></slot>
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not believe this is necessary. As noted, we'll address the Tooltip functionality in Overlay V2 as part of the Tooltip in that work.

Copy link
Contributor Author

@anishAdobe anishAdobe Aug 2, 2023

Choose a reason for hiding this comment

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

This is temporary fix. Once this issue will be addressed in Tooltip functionality in Overlay V2. Will remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not required in the V1 API and leaving it "fixed" will make it harder to include the actual fix in the V2 PR. Please remove.

@anishAdobe anishAdobe force-pushed the users/anishr/actionmenu branch from f3f87d1 to e4dc019 Compare August 2, 2023 05:07
@anishAdobe anishAdobe requested a review from Westbrook August 2, 2023 05:08
@anishAdobe anishAdobe force-pushed the users/anishr/actionmenu branch from 971a6f9 to dfa44f5 Compare August 2, 2023 05:45
@anishAdobe anishAdobe force-pushed the users/anishr/actionmenu branch from d4684d9 to 5e2cb1d Compare August 2, 2023 07:48
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

The code here looks great!

Can you add back the story that was here a couple of commits back? My comment on it was to make sure that it didn't have a visible label by default, not to remove it. Sorry if I was unclear.

With that back in (and the related VRT updates), we should be good to ship this. Thanks!

@anishAdobe anishAdobe requested a review from Westbrook August 2, 2023 14:43
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
@anishAdobe anishAdobe requested a review from Westbrook August 2, 2023 15:34
@Westbrook Westbrook changed the title feat(action-menu): Tooltip for Action Menu fix(action-menu): add a slot for Tooltip content Aug 2, 2023
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

Thanks for working through this with us! Looks good to go 🥳

@Westbrook Westbrook merged commit 23cef3a into main Aug 2, 2023
@Westbrook Westbrook deleted the users/anishr/actionmenu branch August 2, 2023 16:14
@Westbrook Westbrook mentioned this pull request Aug 21, 2023
1 task
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