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(tooltip): update default offset to match Spectrum defs #3632

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/tooltip/src/Tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import type {
OverlayOpenCloseDetail,
Placement,
} from '@spectrum-web-components/overlay';
import {
IS_MOBILE,
MatchMediaController,
} from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';

import tooltipStyles from './tooltip.css.js';
import { ifDefined } from 'lit/directives/if-defined.js';
Expand Down Expand Up @@ -117,6 +121,7 @@ export class Tooltip extends SpectrumElement {
public static override get styles(): CSSResultArray {
return [tooltipStyles];
}
protected isMobile = new MatchMediaController(this, IS_MOBILE);

/**
* Automatically bind to the parent element of the assigned `slot` or the parent element of the `sp-tooltip`.
Expand All @@ -126,7 +131,7 @@ export class Tooltip extends SpectrumElement {
public selfManaged = false;

@property({ type: Number })
public offset = 0;
public offset = this.isMobile.matches ? 5 : 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

The Spectrum specs never mean "mobile" and "desktop" in this way. They mean it relative to the scale the UI is delivered in. I've reached out to the team about tokens for this before we do anything custom here. If we need to do so, we likely want this in https://github.com/adobe/spectrum-web-components/blob/main/tools/styles/scale-medium.css and https://github.com/adobe/spectrum-web-components/blob/main/tools/styles/scale-large.css

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, I wasn't certain if this was referring to the scale or Mobile in general.
And yes it would make sense to check, if this can be solved by a token or spectrum-var.
Will close this for now.


@property({ type: Boolean, reflect: true })
public open = false;
Expand Down
Loading