Skip to content

OcTooltip registers a document keydown listener per element#3171

Description

@JammingBen

Found while investigating #3159.

Current situation

The v-oc-tooltip directive (packages/design-system/src/directives/OcTooltip.ts) registers a keydown listener on document for every element it is bound to, and only removes it on unmount.

File list rows are never unmounted once revealed, so the listener count grows with every item scrolled past.

Measured on a 500-row table:

document keydown listeners
after initial load 135
after scrolling through all 500 rows 3021

That is about 6 per row.

Why this is bad

Every keystroke anywhere in the app fans out to three thousand handlers, each of which only needs to check for Escape. It gets worse the longer a session runs and the more large folders are visited. There is no upper bound.

Proposed solution

Register a single shared keydown handler for the directive that closes whichever tooltip is currently open, instead of one handler per bound element. The per-element mouseenter/mouseleave/focus/blur/click listeners can stay as they are.

Verification

document keydown listener count stays constant across a full scroll pass through a large folder.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    Prio <= 3

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions