Skip to content

fix: share the tooltip escape listener - #3261

Merged
JammingBen merged 2 commits into
opencloud-eu:mainfrom
fredrikblau:fix/3171-share-tooltip-escape-listener
Aug 31, 2026
Merged

fix: share the tooltip escape listener#3261
JammingBen merged 2 commits into
opencloud-eu:mainfrom
fredrikblau:fix/3171-share-tooltip-escape-listener

Conversation

@fredrikblau

Copy link
Copy Markdown
Contributor

Description

Each tooltip instance currently registers its own document-level Escape key listener. This adds one global listener per mounted tooltip and removes it only with that instance.

This change shares one Escape listener across all mounted tooltips and removes it after the last tooltip is unmounted. Tooltip behavior is unchanged.

Related Issue

How Has This Been Tested?

  • test environment: Node.js 26.7.0, pnpm 11.22.0
  • test case 1: pnpm test:unit --run packages/design-system/src/directives/OcTooltip.spec.ts
  • test case 2: pnpm check:types
  • test case 3: pnpm lint
  • test case 4: pnpm format:check

Types of changes

  • Bugfix
  • Enhancement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt (improving code quality without changing functionality)
  • Tests (adding or updating tests)
  • Documentation (updates to the documentation, readme, or changelog)
  • Maintenance (updates to the build process or auxiliary tools and libraries)

Comment thread packages/design-system/src/directives/OcTooltip.ts
@fredrikblau

Copy link
Copy Markdown
Contributor Author

Updated as suggested: tooltip elements are tracked only while visible, with the shared Escape listener registered on show and removed after the last visible tooltip is hidden.

Validated with the focused OcTooltip test, formatting check, and ESLint.

@JammingBen JammingBen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@JammingBen
JammingBen merged commit 838ef52 into opencloud-eu:main Aug 31, 2026
32 checks passed
openclouders pushed a commit that referenced this pull request Aug 31, 2026
…pe-listener

fix: share the tooltip escape listener
@openclouders openclouders mentioned this pull request Aug 31, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OcTooltip registers a document keydown listener per element

3 participants