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

refactor: update tooltip usage #1673

Merged
merged 2 commits into from
Oct 28, 2021
Merged

refactor: update tooltip usage #1673

merged 2 commits into from
Oct 28, 2021

Conversation

Westbrook
Copy link
Contributor

Description

Investigate surfacing tooltips via an alternate API.

Related Issue

refs #1436

Motivation and Context

Less DOM is better DOM.

How Has This Been Tested?

  • needs tests
  • needs VRTs

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@github-actions
Copy link

github-actions bot commented Jul 31, 2021

@github-actions
Copy link

github-actions bot commented Jul 31, 2021

Tachometer results

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 314 kB 26.77ms - 27.68ms - unsure 🔍
-2% - +2%
-0.50ms - +0.58ms
branch 312 kB 26.88ms - 27.48ms unsure 🔍
-2% - +2%
-0.58ms - +0.50ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 790 kB 333.58ms - 339.48ms - unsure 🔍
-0% - +2%
-1.37ms - +6.81ms
branch 784 kB 330.97ms - 336.64ms unsure 🔍
-2% - +0%
-6.81ms - +1.37ms
-

overlay permalink

Version Bytes Avg Time vs remote vs branch
npm latest 416 kB 103.02ms - 105.49ms - unsure 🔍
-2% - +1%
-1.73ms - +1.48ms
branch 414 kB 103.35ms - 105.40ms unsure 🔍
-1% - +2%
-1.48ms - +1.73ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 657 kB 868.32ms - 884.14ms - unsure 🔍
-1% - +1%
-8.50ms - +12.59ms
branch 652 kB 867.21ms - 881.16ms unsure 🔍
-1% - +1%
-12.59ms - +8.50ms
-

popover permalink

Version Bytes Avg Time vs remote vs branch
npm latest 317 kB 42.80ms - 43.60ms - faster ✔
1% - 4%
0.23ms - 1.77ms
branch 315 kB 43.54ms - 44.86ms slower ❌
1% - 4%
0.23ms - 1.77ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 730 kB 2654.19ms - 2690.12ms - unsure 🔍
-0% - +2%
-9.32ms - +46.44ms
branch 725 kB 2632.28ms - 2674.92ms unsure 🔍
-2% - +0%
-46.44ms - +9.32ms
-

tooltip permalink

Version Bytes Avg Time vs remote vs branch
npm latest 320 kB 38.05ms - 39.14ms - faster ✔
2% - 6%
0.91ms - 2.33ms
branch 321 kB 39.76ms - 40.68ms slower ❌
2% - 6%
0.91ms - 2.33ms
-

@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch 4 times, most recently from bd6d81f to c0c2c65 Compare August 5, 2021 19:56
@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch 5 times, most recently from 793d387 to 404c109 Compare August 12, 2021 01:12
@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch from 404c109 to ab043e9 Compare August 31, 2021 01:33
@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch from ab043e9 to e985fda Compare September 10, 2021 01:04
@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch 2 times, most recently from ed77786 to 0625924 Compare October 5, 2021 16:00
@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch from 0625924 to 5e64b35 Compare October 18, 2021 19:51
@Westbrook Westbrook marked this pull request as ready for review October 19, 2021 19:57
@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch 2 times, most recently from fa70b4c to 72bc047 Compare October 19, 2021 21:48
@Westbrook Westbrook changed the title refactor: update tooltip usage, wip refactor: update tooltip usage Oct 19, 2021
@hunterloftis hunterloftis self-assigned this Oct 21, 2021

private openOverlay = async (): Promise<void> => {
const parentElement = this.parentElement as HTMLElement;
this.closeOverlayCallback = await openOverlay(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just realizing that this PR exhibits the same asynchronous issue that we recently massages out of overlay-trigger 😱 I'll clean this up today so that it matches what we ended up with in that element, which is much nicer!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might also have something to do with why overlay-trigger tooltips and sp-tooltip[auto] surface content to the screen reader differently. Will review that more closely as well!

Copy link
Contributor

@hunterloftis hunterloftis left a comment

Choose a reason for hiding this comment

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

Sorry to bikeshed, but is auto the best description for this inverted tooltip API for a user who isn't necessarily expert at the underlying implementations? I wonder if something like nested, contained, or inner might be more intuitive.

packages/overlay/src/ActiveOverlay.ts Outdated Show resolved Hide resolved
Comment on lines 167 to 166
private closeOverlay = (): void => {
if (this.closeOverlayCallback) {
this.closeOverlayCallback();
delete this.closeOverlayCallback;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

We might exit early here to reduce a level of nesting:

Suggested change
private closeOverlay = (): void => {
if (this.closeOverlayCallback) {
this.closeOverlayCallback();
delete this.closeOverlayCallback;
}
};
private closeOverlay(): void {
if (!this.closeOverlayCallback) return;
this.closeOverlayCallback();
delete this.closeOverlayCallback;
};

@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch 4 times, most recently from f8a846c to c178b66 Compare October 25, 2021 19:21
@Westbrook
Copy link
Contributor Author

@hunterloftis I get your request for renaming this attribute, but I'm not sure I can agree to any of the suggested. If managed or self-managed an acceptable alternative?

In a breaking API change, I might prefer to call this default and the versions that require wrapping managed. Maybe we wait till 1.0 and do something like that? 🤔

@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch from c178b66 to 88ac612 Compare October 25, 2021 19:48
@hunterloftis
Copy link
Contributor

hunterloftis commented Oct 26, 2021

@Westbrook I can get behind managed. I guess the real information to be conveyed is that it's "automatically managed" 😁 but that would be a mouthful of an attribute! (self-managed works as well for me)

@hunterloftis
Copy link
Contributor

@Westbrook before re-approving I was going to run through a quick manual test. Do we have a new storybook link? https://westbrook-tooltip-alt--spectrum-web-components.netlify.app/storybook/ (from the above bot) loads the docs site.

@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch from dfe86b4 to 16ef0ad Compare October 26, 2021 18:56
@Westbrook
Copy link
Contributor Author

I went with self-managed for now, but I do think that the inverse would be preferable post 1.0. I've created #1885 to track.

Once the CI runs through we should get Storybook back 🙈

@hunterloftis
Copy link
Contributor

I'm seeing some unexpected behavior in the storybook:

self-managed-tooltip-sizing-artifacts.mov

@@ -19,6 +19,10 @@ governing permissions and limitations under the License.
border: none;
}

:host([auto]:not([aria-hidden])) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Look who didn't get updated 👀 😱

@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch from 16ef0ad to 2264db8 Compare October 26, 2021 21:16
hunterloftis
hunterloftis previously approved these changes Oct 26, 2021
@Westbrook Westbrook force-pushed the westbrook/tooltip-alt branch from 2264db8 to f92e6c9 Compare October 28, 2021 12:25
@Westbrook Westbrook merged commit 82e7c08 into main Oct 28, 2021
@Westbrook Westbrook deleted the westbrook/tooltip-alt branch October 28, 2021 12:34
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