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

Add some delay before logging calcite-tooltip missing element warnings #11094

Open
2 of 5 tasks
nCastle1 opened this issue Dec 17, 2024 · 1 comment
Open
2 of 5 tasks
Labels
0 - new New issues that need assignment. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive needs triage Planning workflow - pending design/dev review.

Comments

@nCastle1
Copy link

Check existing issues

Description

calcite-tooltip checks for the presence of reference-element immediately and logs a warning if the reference element is not present. In the general case this makes sense, but with some libraries (e.g. React, Maquette), the developer doesn't directly control DOM manipulation and this can lead to problems.

For example, consider the scenario where the developer has a calcite-action-pad, with a series of calcite-action, each with an associated calcite-tooltip. When the user makes some selection in the document, context-specific menu items are added to the action-pad, each with their own tooltip. When the selection is cleared, these items are removed.

Depending on framework, the tooltip might be added or removed before or after the referenced element. Because the DOM elements are added and removed sequentially, it is possible for the calcite-tooltip to log the warning while the render is still in progress.

While it is possible to workaround, for example by always rendering the conditional elements and using styling to hide the inactive elements, or by messing with the order of elements returned by render call, it isn't ideal.

Acceptance Criteria

Have some delay such that, when using React and other virtual DOM systems there is no warning logged when:

  • A single render call adds both a tooltip and the tooltip's referenced element
  • A single render call removes both a tooltip and the tooltip's referenced element

Relevant Info

No response

Which Component

calcite-tooltip

Example Use Case

While converting the Maps SDK for JavaScript's Sketch widget to use Calcite components, I added calcite-tooltip in an effort to improve tool discoverability and better match other ArcGIS apps that use calcite-action-pad. Unfortunately, I was not able to keep these tooltips in place for a few reasons. One of those reasons was log noise coming from calcite-tooltip.

Priority impact

impact - p3 - not time sensitive

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Maps SDK for JavaScript

@nCastle1 nCastle1 added 0 - new New issues that need assignment. enhancement Issues tied to a new feature or request. needs triage Planning workflow - pending design/dev review. labels Dec 17, 2024
@github-actions github-actions bot added ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive labels Dec 17, 2024
@driskull
Copy link
Member

@nCastle1 it would be better to set the referenceElement to an actual DOM element in these cases instead of a string id to avoid this kind of scenario. In addition, its more performant because it doesn't have to query the dom by ID to find the element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive needs triage Planning workflow - pending design/dev review.
Projects
None yet
Development

No branches or pull requests

2 participants