Skip to content

disabled on tooltip trigger does not work when asChild is true #3476

@crtl

Description

@crtl

Bug report

Current Behavior

disabled does nothing.

Expected behavior

disabled should disable the tooltip

Reproducible example

https://codesandbox.io/p/sandbox/condescending-thunder-zrx29t

Suggested solution

Short circuat event listeners when disabled tooltip is disabled so the tooltip is not triggered at all and doesnt rely on children to disable pointer events in dom.

Additional context

It would be nice if you could disable/enable tooltips somehow without conditionally render them which allows for more uses cases.

Your environment

{
  "name": "radix-primitives-template",
  "version": "1.0.0",
  "description": "",
  "keywords": [],
  "main": "src/index.js",
  "dependencies": {
    "@radix-ui/react-accessible-icon": "latest",
    "@radix-ui/react-accordion": "latest",
    "@radix-ui/react-alert-dialog": "latest",
    "@radix-ui/react-announce": "latest",
    "@radix-ui/react-arrow": "0.0.1",
    "@radix-ui/react-aspect-ratio": "latest",
    "@radix-ui/react-avatar": "latest",
    "@radix-ui/react-collapsible": "latest",
    "@radix-ui/react-context-menu": "latest",
    "@radix-ui/react-dialog": "latest",
    "@radix-ui/react-dropdown-menu": "latest",
    "@radix-ui/react-label": "latest",
    "@radix-ui/react-popover": "latest",
    "@radix-ui/react-portal": "latest",
    "@radix-ui/react-progress": "latest",
    "@radix-ui/react-radio-group": "latest",
    "@radix-ui/react-scroll-area": "latest",
    "@radix-ui/react-separator": "latest",
    "@radix-ui/react-slider": "latest",
    "@radix-ui/react-switch": "latest",
    "@radix-ui/react-tabs": "latest",
    "@radix-ui/react-toggle-button": "latest",
    "@radix-ui/react-tooltip": "latest",
    "@radix-ui/react-visually-hidden": "latest",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-scripts": "3.3.0"
  },
  "devDependencies": {
    "typescript": "3.7.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions