Skip to content

Chart tooltips do not activate when used in iPads set to Request Desktop Websites #2045

@lhargil

Description

@lhargil

Describe the bug
Tapping on chart elements to activate a tooltip does not work as expected when Safari is set to Request Desktop Website in an iPad.

As I found out, it is because the navigator.userAgent string that it reports in this mode is not covered by the regex defined in the tooltip.directive.ts in order to set the appropriate timeout value.

: this.tooltipShowTimeout + (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) ? 400 : 0);

Instead, its navigator.userAgent string reports as:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15

To Reproduce
Steps to reproduce the behavior:

  1. Using the browser Safari on an iPad, navigate to https://swimlane.github.io/ngx-charts/#/ngx-charts/tooltip-templates.
  2. Click on any of the vertical bars shown in the page.
  3. No tooltip is shown.

Expected behavior
Regardless if Desktop or Mobile browsing mode is set iPad Safari, the tooltip should activate and show the relevant info.

Screenshots
With Safari set to "Request Desktop Website", the tooltip does not activate after tapping on the United Kingdom bar.
Image

Demo
N/A

ngx-charts version
v21.1.0 in the link provided above, but the same bug occurs with v22.0.0, used in our app.

Additional context
Angular Version: v19.2.13

Test device settings

iPad Pro 11
OS: iOS, v17.5
Browser: Safari

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions