{"_id":"@a11y-ngx/tooltip","_rev":"15-0749b1b9c58f12adee8aeec6e70f67ca","name":"@a11y-ngx/tooltip","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.5":{"name":"@a11y-ngx/tooltip","version":"1.0.5","keywords":["tooltip","overlay","position","positioning","reposition","overflow","component","directive","scroll","scrolling","resize","a11y","accessibility","angular"],"author":{"url":"https://github.com/LDV2k3/","name":"Luciano Del Vacchio","email":"lucho.development@gmail.com"},"license":"MPL-2.0","_id":"@a11y-ngx/tooltip@1.0.5","maintainers":[{"name":"ldv","email":"lucho.development@gmail.com"}],"homepage":"https://github.com/LDV2k3/a11y-libraries/tree/master/projects/a11y-ngx/tooltip#readme","bugs":{"url":"https://github.com/LDV2k3/a11y-libraries/issues","email":"lucho.development@gmail.com"},"dist":{"shasum":"e59dc0ec37addc70d57b27e7ea9dc7311f84d766","tarball":"https://registry.npmjs.org/@a11y-ngx/tooltip/-/tooltip-1.0.5.tgz","fileCount":30,"integrity":"sha512-CBHt6zqTNBwxFem1tyacTh75KRju9E97c0xUfKOeQtCHu4QXsRJjy0VEEGIKWSD1bUVSIUBoVUHiLhXjr8VhkA==","signatures":[{"sig":"MEYCIQDioAdJfZYk4Ab9MRDYJEYILicchlAgLWFI5cWebi49ewIhAOitxy+ERO/izHVIEGpmsDbhLTW0qQ4PxDYHoASrkCuF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":450347},"main":"bundles/a11y-ngx-tooltip.umd.js","es2015":"fesm2015/a11y-ngx-tooltip.js","module":"fesm2015/a11y-ngx-tooltip.js","esm2015":"esm2015/a11y-ngx-tooltip.js","gitHead":"fed2176d818677019991f4505038efe54183a2fd","typings":"a11y-ngx-tooltip.d.ts","_npmUser":{"name":"ldv","email":"lucho.development@gmail.com"},"fesm2015":"fesm2015/a11y-ngx-tooltip.js","_npmVersion":"8.19.4","description":"A fully accessible tooltip directive that provides a standards-compliant experience across mouse, keyboard and touch interactions","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{"tslib":"^1.10.0","@a11y-ngx/overlay":"^1.0.3","@a11y-ngx/sr-only":"^1.0.1","@a11y-ngx/dom-helper":"^1.1.1","@a11y-ngx/color-scheme":"^1.0.7"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":">=12.2.0 <21.0.0","@angular/common":">=12.2.0 <21.0.0"},"peerDependenciesMeta":{"@a11y-ngx/responsive-image-maps":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/tooltip_1.0.5_1762125467138_0.7571433790114599","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@a11y-ngx/tooltip","version":"1.0.7","keywords":["tooltip","overlay","position","positioning","reposition","overflow","component","directive","scroll","scrolling","resize","a11y","accessibility","angular"],"author":{"url":"https://github.com/LDV2k3/","name":"Luciano Del Vacchio","email":"lucho.development@gmail.com"},"license":"MPL-2.0","_id":"@a11y-ngx/tooltip@1.0.7","maintainers":[{"name":"ldv","email":"lucho.development@gmail.com"}],"homepage":"https://github.com/LDV2k3/a11y-libraries/tree/master/projects/a11y-ngx/tooltip#readme","bugs":{"url":"https://github.com/LDV2k3/a11y-libraries/issues","email":"lucho.development@gmail.com"},"dist":{"shasum":"9c4ffd55d4b519a7ceab4076d99d6f66b2f2801c","tarball":"https://registry.npmjs.org/@a11y-ngx/tooltip/-/tooltip-1.0.7.tgz","fileCount":32,"integrity":"sha512-MkwtiMY6bTeLZspmc1idRyyKSWHuXSRWqJubWZ1FIqTFcULXcZ4H3A28ZOe5S0grdyId1hD6+yTTGtHx0UJ5xA==","signatures":[{"sig":"MEQCIDzFHQDV3CoitVmOBkDmE9kDZVuDCFUh9rBeA1FwgNqEAiBfWZFFQVqM8lsXMeskrN3m8TTNU+ZrE3iCaFk8WkUGHg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":458060},"main":"bundles/a11y-ngx-tooltip.umd.js","es2015":"fesm2015/a11y-ngx-tooltip.js","module":"fesm2015/a11y-ngx-tooltip.js","esm2015":"esm2015/a11y-ngx-tooltip.js","gitHead":"bd4bbe7d9618625f31374062712c527592671696","typings":"a11y-ngx-tooltip.d.ts","_npmUser":{"name":"ldv","email":"lucho.development@gmail.com"},"fesm2015":"fesm2015/a11y-ngx-tooltip.js","_npmVersion":"8.19.4","description":"A fully accessible tooltip directive that provides a standards-compliant experience across mouse, keyboard and touch interactions","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{"tslib":"^1.10.0","@a11y-ngx/overlay":"^1.0.4","@a11y-ngx/sr-only":"^1.0.1","@a11y-ngx/dom-helper":"^1.1.1","@a11y-ngx/color-scheme":"^1.0.8"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":">=12.2.0 <21.0.0","@angular/common":">=12.2.0 <21.0.0"},"peerDependenciesMeta":{"@a11y-ngx/responsive-image-maps":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/tooltip_1.0.7_1764080001643_0.13728096890060804","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"@a11y-ngx/tooltip","version":"1.0.8","description":"A fully accessible tooltip directive that provides a standards-compliant experience across mouse, keyboard and touch interactions","keywords":["tooltip","overlay","position","positioning","reposition","overflow","component","directive","scroll","scrolling","resize","a11y","accessibility","accessible","angular"],"homepage":"https://github.com/LDV2k3/a11y-libraries/tree/master/projects/a11y-ngx/tooltip#readme","bugs":{"url":"https://github.com/LDV2k3/a11y-libraries/issues","email":"lucho.development@gmail.com"},"license":"MPL-2.0","author":{"name":"Luciano Del Vacchio","email":"lucho.development@gmail.com","url":"https://github.com/LDV2k3/"},"peerDependencies":{"@angular/common":">=12.2.0 <21.0.0","@angular/core":">=12.2.0 <21.0.0"},"peerDependenciesMeta":{"@a11y-ngx/responsive-image-maps":{"optional":true}},"dependencies":{"tslib":"^1.10.0","@a11y-ngx/overlay":"^1.0.6","@a11y-ngx/dom-helper":"^1.1.1","@a11y-ngx/color-scheme":"^1.0.9","@a11y-ngx/sr-only":"^1.0.1"},"main":"bundles/a11y-ngx-tooltip.umd.js","module":"fesm2015/a11y-ngx-tooltip.js","es2015":"fesm2015/a11y-ngx-tooltip.js","esm2015":"esm2015/a11y-ngx-tooltip.js","fesm2015":"fesm2015/a11y-ngx-tooltip.js","typings":"a11y-ngx-tooltip.d.ts","sideEffects":false,"gitHead":"58592837579c5575250a8a2132eb42804ed05ddb","_id":"@a11y-ngx/tooltip@1.0.8","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-0RS2R62m+SZzKj4eb6rpb1S6tv0xqSW50NoTAvky4pcrNALtIdQDDXuIQz3fy9Xod836q2mKMQq3ADPPJg4sEw==","shasum":"924d7719ed50fb21ddcbbcbd431ab78113b88569","tarball":"https://registry.npmjs.org/@a11y-ngx/tooltip/-/tooltip-1.0.8.tgz","fileCount":32,"unpackedSize":453546,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD9aDdrCrMfgA+IryFgM4qrrlQoOhfg6OOwLvUfm8+G0QIgDwdVUQfbqh8p/2GV4lEaezIOO1nJMw31Jw3L7tEFbQI="}]},"_npmUser":{"name":"ldv","email":"lucho.development@gmail.com"},"directories":{},"maintainers":[{"name":"ldv","email":"lucho.development@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tooltip_1.0.8_1767621313243_0.6824980397022069"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-30T15:35:44.631Z","modified":"2026-01-05T13:55:13.652Z","1.0.0":"2025-10-30T15:35:44.999Z","1.0.1":"2025-10-30T15:39:27.068Z","1.0.2":"2025-10-31T13:22:12.264Z","1.0.3":"2025-10-31T14:29:58.666Z","1.0.4":"2025-10-31T22:53:49.949Z","1.0.5":"2025-11-02T23:17:47.365Z","1.0.6":"2025-11-21T17:14:53.608Z","1.0.7":"2025-11-25T14:13:21.847Z","1.0.8":"2026-01-05T13:55:13.461Z"},"bugs":{"url":"https://github.com/LDV2k3/a11y-libraries/issues","email":"lucho.development@gmail.com"},"author":{"name":"Luciano Del Vacchio","email":"lucho.development@gmail.com","url":"https://github.com/LDV2k3/"},"license":"MPL-2.0","homepage":"https://github.com/LDV2k3/a11y-libraries/tree/master/projects/a11y-ngx/tooltip#readme","keywords":["tooltip","overlay","position","positioning","reposition","overflow","component","directive","scroll","scrolling","resize","a11y","accessibility","accessible","angular"],"description":"A fully accessible tooltip directive that provides a standards-compliant experience across mouse, keyboard and touch interactions","maintainers":[{"name":"ldv","email":"lucho.development@gmail.com"}],"readme":"# Tooltip\r\n\r\nA fully accessible tooltip directive for Angular that provides a standards-compliant experience across mouse, keyboard and touch interactions.\r\n\r\nIt's built with WCAG 2.1/2.2 AA compliance in mind:\r\n\r\n✔️ Shows on **mouse hover**, **focus** or **touch** (with configurable delay for each)<br />\r\n✔️ Hides on **mouse leave**, **blur**, **touch outside** or **Escape** key (it also supports extra configurable keys for toggle its visibility)<br />\r\n✔️ It remains visible even when hover over the tooltip<br />\r\n✔️ It will also cover elements with `title` attribute (usually `<abbr>` or any other you may have)<br />\r\n✔️ Color contrast ratio of at least 4.5:1 for the basic themes availables (`'light'` and `'dark'`)<br />\r\n✔️ Ensures that the tooltip's text is always present for assistive technologies, either by the ARIA association between trigger and tooltip, or visually hidden text if it is not an interactive element<br />\r\n✔️ It will open to the most appropriate side when space is limited on the preferred position<br />\r\n✔️ It will reposition itself, if needed, in case of page scroll or resize<br />\r\n\r\n> ⚠️ **IMPORTANT:** Think carefully at what you are adding a tooltip to, remember that there are people with disabilities who can't use a mouse and rely on a keyboard for navigation, so adding a tooltip to non-interactive elements (`<i>`, `<span>`, etc.) won't be reachable by keyboard and thus the tooltip won't appear.\r\n>\r\n> 📘 **NOTE:** Since tooltips are meant to provide purely informational content, only basic inline tags (`<b>`, `<strong>`, `<i>`, `<em>` and `<br>`) are allowed. All other markup will be removed for consistency and accessibility.\r\n\r\nThis library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0.\r\n\r\n## Index\r\n\r\n- [Installation](#installation)\r\n- [The `rootConfig()` Method](#the-rootconfig-method)\r\n- [The Tooltip Config](#the-tooltip-config)\r\n  - [The Position Input](#the-position-input)\r\n    - [The Positions Allowed Input](#the-positions-allowed-input)\r\n    - [The Alignments Allowed Input](#the-alignments-allowed-input)\r\n  - [The Position Strategy](#the-position-strategy)\r\n  - [The Custom Boundary](#the-custom-boundary)\r\n  - [The Safe Space](#the-safe-space)\r\n  - [The Fluid Alignment](#the-fluid-alignment)\r\n  - [The Arrow Size](#the-arrow-size)\r\n  - [The Offset Size](#the-offset-size)\r\n  - [The Fade Timeout](#the-fade-timeout)\r\n  - [The Fade Delay Timeout](#the-fade-delay-timeout)\r\n  - [The Delay On Event](#the-delay-on-event)\r\n  - [The zIndex](#the-zindex)\r\n  - [The Padding](#the-padding)\r\n  - [The Shadow](#the-shadow)\r\n  - [The Background Color](#the-background-color)\r\n  - [The Text Color](#the-text-color)\r\n  - [The Border Size](#the-border-size)\r\n  - [The Border Border](#the-border-color)\r\n  - [The Border Radius](#the-border-radius)\r\n  - [The Max Width](#the-max-width)\r\n  - [The Class Names](#the-class-names)\r\n  - [Use Animate](#use-animate)\r\n  - [Use Prevail](#use-prevail)\r\n  - [Use As Label](#use-as-label)\r\n  - [Toggle On](#toggle-on)\r\n- [The `recalculate()` Method](#the-recalculate-method)\r\n- [The Color Schemes](#the-color-schemes)\r\n  - [How to Configure the Color Schemes](#how-to-configure-the-color-schemes)\r\n  - [How to Force a Scheme](#how-to-force-a-scheme)\r\n  - [How to add a New Color Scheme](#how-to-add-a-new-color-scheme)\r\n- [The Use with Image Maps](#the-use-with-image-maps)\r\n- [The Use with Abbreviation Elements](#the-use-with-abbreviation-elements)\r\n- [The Use with Non-Interactive Elements](#the-use-with-non-interactive-elements)\r\n\r\n## Installation\r\n\r\n1. Install npm package:\r\n\r\n   `npm install @a11y-ngx/tooltip --save`\r\n\r\n2. Import `A11yTooltipModule` into your module or standalone component:\r\n\r\n```typescript\r\nimport { A11yTooltipModule } from '@a11y-ngx/tooltip';\r\n\r\n@NgModule({\r\n    declarations: [...],\r\n    imports: [\r\n        ...\r\n        A11yTooltipModule,\r\n    ],\r\n})\r\nexport class AppModule { }\r\n```\r\n\r\n### The `rootConfig()` Method\r\n\r\nServes to establish and override the global default configuration.\r\n\r\nAccepts a single parameter `config` of type [`TooltipRootConfig`](#the-tooltip-config).\r\n\r\n**On Angular v12 - v14:**\r\n\r\n```typescript\r\nA11yTooltipModule.rootConfig({\r\n    offsetSize: 10,\r\n    safeSpace: { top: 65, left: 50 },\r\n}),\r\n```\r\n\r\n**On Angular v15+:**\r\n\r\n```typescript\r\nprovideA11yTooltip({\r\n    offsetSize: 10,\r\n    safeSpace: { top: 65, left: 50 },\r\n}),\r\n```\r\n\r\n## The Tooltip Config\r\n\r\nThe `TooltipConfig` provides several properties to customize.\r\n\r\n- **Input:** `tooltipConfig`.\r\n- **Type:** `TooltipConfig`.\r\n\r\n> All color related default values (★) are coming from the variables set within [the Color Scheme global configuration](https://www.npmjs.com/package/@a11y-ngx/color-scheme#user-content-global-config-basic-properties).\r\n\r\n| Property | Type | Description |\r\n| :------- | :--- | :---------- |\r\n| `position` | `OverlayPositionInput` | See [the Position Input](#the-position-input) |\r\n| `positionStrategy` | `OverlayPositionStrategy` | See [the Position Strategy](#the-position-strategy) |\r\n| `positionsAllowed` | `OverlayPositionsAllowedInput` | See [the Positions Allowed Input](#the-positions-allowed-input) |\r\n| `alignmentsAllowed` | `OverlayAlignmentsAllowedInput` | See [the Alignments Allowed Input](#the-alignments-allowed-input) |\r\n| `safeSpace` | `OverlaySafeSpace` | See [the Safe Space](#the-safe-space) |\r\n| `fluidAlignment` | `boolean` | See [the Fluid Alignment](#the-fluid-alignment) |\r\n| `arrowSize` | `number` | See [the Arrow Size](#the-arrow-size) |\r\n| `offsetSize` | `number` | See [the Offset Size](#the-offset-size) |\r\n| `fadeMs` | `number` | See [the Fade Timeout](#the-fade-timeout) |\r\n| `fadeDelayMs` | `number` | See [the Fade Delay Timeout](#the-fade-delay-timeout) |\r\n| `delayOnEvent` | `TooltipDelayEvents` | See [the Delay On Event](#the-delay-on-event) |\r\n| `animate` | `boolean` | See [Use Animate](#use-animate) |\r\n| `prevail` | `boolean` | See [Use Prevail](#use-prevail) |\r\n| `asLabel` | `boolean` | See [Use as Label](#use-as-label) |\r\n| `toggleOn` | `string[]` | See [Toggle On](#toggle-on) |\r\n| `zIndex` | `number` | See [the zIndex](#the-zindex) |\r\n| `padding` | `string` | See [the Padding](#the-padding) |\r\n| `shadow` ★ | `string` | See [the Shadow](#the-shadow) |\r\n| `shadowColor` ★ | `string` | See [the Shadow](#the-shadow) |\r\n| `backgroundColor` ★ | `string` | See [the Background Color](#the-background-color) |\r\n| `textColor` ★ | `string` | See [the Text Color](#the-text-color) |\r\n| `borderSize` | `number` | See [the Border Size](#the-border-size) |\r\n| `borderColor` ★ | `string` | See [the Border Color](#the-border-color) |\r\n| `borderRadius` | `number` | See [the Border Radius](#the-border-radius) |\r\n| `className` | `string` or `string[]` | See [the Class Names](#the-class-names) |\r\n| `maxWidth` | `string` | See [the Max Width](#the-max-width) |\r\n  \r\nAs part as the config object, there is a set of properties for Color Scheme:\r\n  \r\n- **Dependency:** [Color Scheme library](https://www.npmjs.com/package/@a11y-ngx/color-scheme#the-color-scheme-config-styles-config).\r\n- **Type:** `ColorSchemeStylesConfig`.\r\n- **Properties:**\r\n  \r\n| Property | Type | Description |\r\n| :------- | :--- | :---------- |\r\n| `colorSchemes` | `ColorSchemesStyles` | See [how to Configure the Color Schemes](#how-to-configure-the-color-schemes) |\r\n| `forceScheme` | `ColorScheme` | See [how to Force a Scheme](#how-to-force-a-scheme) |\r\n\r\n### The Position Input\r\n\r\nTo input, in a simple way, either position or position & alignment (hyphen separated if `string` is used).\r\n\r\n- **Config Property:** `position`.\r\n- **Type:** `OverlayPositionInput`.\r\n- **Default:** `['top', 'center']`.\r\n\r\n> For more details, check [the Position Input from the Overlay library](https://www.npmjs.com/package/@a11y-ngx/overlay#the-position-input).\r\n\r\n#### The Positions Allowed Input\r\n\r\nTo establish which positions are allowed.\r\n\r\n- **Config Property:** `positionsAllowed`.\r\n- **Type:** `OverlayPositionsAllowedInput`.\r\n- **Default:** `'auto'` (all sides are allowed).\r\n- **You can use:** `'auto'`, `'opposite'`, `string` or `string[]`.\r\n\r\n> For more details, check [the Positions Allowed Input from the Overlay library](https://www.npmjs.com/package/@a11y-ngx/overlay#the-positions-allowed-input).\r\n\r\n#### The Alignments Allowed Input\r\n\r\nTo establish which alignments are allowed.\r\n\r\n- **Config Property:** `alignmentsAllowed`.\r\n- **Type:** `OverlayAlignmentsAllowedInput`.\r\n- **Default:** `'auto'` (all alignments are allowed).\r\n- **You can use:** `'auto'`, `'edges'`, an alignment value (`'start'`, `'center'`, `'end'`) or an array of them.\r\n\r\n> For more details, check [the Alignments Allowed Input from the Overlay library](https://www.npmjs.com/package/@a11y-ngx/overlay#the-alignments-allowed-input).\r\n\r\n### The Position Strategy\r\n\r\nTo establish whether a `fixed` or `absolute` strategy positioning is used in CSS.\r\n\r\n- **Config Property:** `positionStrategy`.\r\n- **Type:** `OverlayPositionStrategy`.\r\n- **Default:** `'fixed'`.\r\n- **Values:** `'fixed'` or `'absolute'`.\r\n\r\nThe `absolute` strategy was designed mainly to be utilized inside containers with overflow (such as responsive tables) and to avoid the tooltip to be seen in case of scrolling while the trigger being visually hidden.\r\n\r\n> For more details and examples, check [the Position Strategy from the Overlay library](https://www.npmjs.com/package/@a11y-ngx/overlay#the-position-strategy).\r\n\r\n### The Custom Boundary\r\n\r\nA custom boundary can be interpreted as a wrapper/container, and the tooltip will consider that boundary as the new limits for its positioning.\r\n\r\n- **Config Property:** `boundary`.\r\n- **Type:** `HTMLElement`.\r\n- **Default:** `<body>`.\r\n\r\n> For more details and examples, check [the Custom Boundary from the Overlay library](https://www.npmjs.com/package/@a11y-ngx/overlay#the-custom-boundary).\r\n\r\n### The Safe Space\r\n\r\nTo establish an extra safe space to the viewport's edges in case some fixed areas are present, such as headers, side menus or footers.\r\n\r\nThis way, the tooltip will consider this area as the _edge limit_ and reposition itself if reached. Most useful use cases are related to scroll events.\r\n\r\n- **Config Property:** `safeSpace`.\r\n- **Type:** `OverlaySafeSpace`:\r\n  - `object` with each side as a property of type `number`.\r\n- **Default:** `{ top: 0, bottom: 0, left: 0, right: 0 }`.\r\n\r\n> For more details and examples, check from the Overlay library:\r\n>\r\n> - [The Safe Space](https://www.npmjs.com/package/@a11y-ngx/overlay#the-safe-space).\r\n>   - [The Safe Space Off](https://www.npmjs.com/package/@a11y-ngx/overlay#the-safe-space-off).\r\n>   - [The Safe Space On](https://www.npmjs.com/package/@a11y-ngx/overlay#the-safe-space-on).\r\n>   - [The Safe Space and zIndex Issues](https://www.npmjs.com/package/@a11y-ngx/overlay#the-safe-space-and-zindex-issues).\r\n\r\n### The Fluid Alignment\r\n\r\nTo establish whether the tooltip's alignment will stick to the edges of the viewport/boundary (if set to `true`) or make jumps between `start`, `center` or `end` (if set to `false`).\r\n\r\n- **Config Property:** `fluidAlignment`.\r\n- **Type:** `boolean`.\r\n- **Default:** `false`.\r\n\r\nAs you can see in the next example, the fluid alignment is set to `false` (by default), which will make the tooltip to be aligned to the \"end\" of its trigger since it's too close to the viewport's right side and doesn't have enough space to be centered (default alignment).\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-fluid-alignment-off.jpg)\r\n\r\nIf we turn fluid alignment on, then the tooltip will stick to the right side of the viewport.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-fluid-alignment-on.jpg)\r\n\r\n> For more details and examples, check from the Overlay library\r\n>\r\n> - [The Fluid Alignment](https://www.npmjs.com/package/@a11y-ngx/overlay#the-fluid-alignment).\r\n>   - [The Fluid Alignment On or Off](https://www.npmjs.com/package/@a11y-ngx/overlay#the-fluid-alignment-on-or-off).\r\n\r\n### The Arrow Size\r\n\r\nIt defines the size of the arrow.\r\n\r\n- **Config Property:** `arrowSize`.\r\n- **Type:** `number`.\r\n- **Default:** `5`.\r\n- **Accepts:** zero or greater.\r\n- **Translated to:** _pixels_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-arrow-size.jpg)\r\n\r\n### The Offset Size\r\n\r\nIt defines the space between the tooltip's arrow and its trigger.\r\n\r\n- **Config Property:** `offsetSize`.\r\n- **Type:** `number`.\r\n- **Default:** `5`.\r\n- **Accepts:** positives and negatives.\r\n- **Translated to:** _pixels_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-offset-size.jpg)\r\n\r\n### The Fade Timeout\r\n\r\nIt defines the timeout to fade in or out the tooltip.\r\n\r\n- **Config Property:** `fadeMs`.\r\n- **Type:** `number`.\r\n- **Default:** `125`.\r\n- **Translated to:** _milliseconds_.\r\n\r\n### The Fade Delay Timeout\r\n\r\nIt is the time it will take to start to fade in or out after the tooltip is shown or hidden.\r\n\r\n- **Config Property:** `fadeDelayMs`.\r\n- **Type:** `number`.\r\n- **Default:** `400`.\r\n- **Translated to:** _milliseconds_.\r\n\r\n### The Delay On Event\r\n\r\nTo establish on which events should delay (`fadeDelayMs` property) when show/hide the tooltip.\r\n\r\n- **Config Property:** `delayOnEvent`.\r\n- **Type:** `TooltipDelayEvents`.\r\n- **Default:** `{ mouse: true, keyboard: false, touch: false }`.\r\n\r\n### The zIndex\r\n\r\nIt defines the `z-index` CSS value.\r\n\r\nThis can be helpful for scenarios where the page contains fixed landmarks. See [the Safe Space and zIndex issues from the Overlay library](https://www.npmjs.com/package/@a11y-ngx/overlay#the-safe-space-and-zindex-issues).\r\n\r\n- **Config Property:** `zIndex`.\r\n- **Type:** `number`.\r\n- **Default:** `9999`.\r\n\r\n### The Padding\r\n\r\nIt defines the `padding` CSS value.\r\n\r\n- **Config Property:** `padding`.\r\n- **Type:** `string`.\r\n- **Default:** `'3px 7px'` (`3px` top & bottom, `7px` left & right).\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-padding-size.jpg)\r\n\r\n### The Shadow\r\n\r\nIt defines the `box-shadow` CSS value, by combining two properties:\r\n\r\n- **Config Property:** `shadow`.\r\n  - **Type:** `string`.\r\n  - **Default:** `none`.\r\n- **Config Property:** `shadowColor`.\r\n  - **Type:** `string`.\r\n  - **Default:** `var(--a11y-shadow-color)` _(coming from the [Color Scheme library](https://www.npmjs.com/package/@a11y-ngx/color-scheme#user-content-global-config-basic-properties))_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-shadow.jpg)\r\n\r\n### The Background Color\r\n\r\nIt defines the `background-color` CSS value.\r\n\r\n- **Config Property:** `backgroundColor`.\r\n- **Type:** `string`.\r\n- **Default:** `var(--a11y-bg-color)` _(coming from the [Color Scheme library](https://www.npmjs.com/package/@a11y-ngx/color-scheme#user-content-global-config-basic-properties))_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-background-color.jpg)\r\n\r\n### The Text Color\r\n\r\nIt defines the `color` CSS value.\r\n\r\n- **Config Property:** `textColor`.\r\n- **Type:** `string`.\r\n- **Default:** `var(--a11y-text-color)` _(coming from the [Color Scheme library](https://www.npmjs.com/package/@a11y-ngx/color-scheme#user-content-global-config-basic-properties))_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-text-color.jpg)\r\n\r\n### The Border Size\r\n\r\nIt defines the `border-width` CSS value.\r\n\r\n- **Config Property:** `borderSize`.\r\n- **Type:** `number`.\r\n- **Default:** `1`.\r\n- **Translated to:** _pixels_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-border-size.jpg)\r\n\r\n### The Border Color\r\n\r\nIt defines the `border-color` CSS value.\r\n\r\n- **Config Property:** `borderColor`.\r\n- **Type:** `string`.\r\n- **Default:** `var(--a11y-border-color)` _(coming from the [Color Scheme library](https://www.npmjs.com/package/@a11y-ngx/color-scheme#user-content-global-config-basic-properties))_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-border-color.jpg)\r\n\r\n### The Border Radius\r\n\r\nIt defines the `border-radius` CSS value.\r\n\r\n- **Config Property:** `borderRadius`.\r\n- **Type:** `number`.\r\n- **Default:** `4` (same for each corner).\r\n- **Translated to:** _pixels_.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-border-radius.jpg)\r\n\r\n### The Max Width\r\n\r\nIt defines the maximum width allowed for the tooltip.\r\n\r\n- **Config Property:** `maxWidth`.\r\n- **Type:** `string`.\r\n- **Default:** `'200px'`.\r\n- **You can use:** `px`, `em`, `%`, etc.\r\n\r\n### The Class Names\r\n\r\nIt defines custom class names for your tooltip element.\r\n\r\n- **Config Property:** `className`.\r\n- **Type:** `string` or `string[]`.\r\n- **Default:** _unset_.\r\n\r\n### Use Animate\r\n\r\nTo establish wether to use a small CSS animation when show/hide the tooltip.\r\n\r\n- **Config Property:** `animate`.\r\n- **Type:** `boolean`.\r\n- **Default:** `true`.\r\n\r\n### Use Prevail\r\n\r\nTo establish wether the tooltip will prevail open when the user hovers over it.\r\n\r\n> **NOTE:** The WCAG 2.1/2.2 - Criteria 1.4.13: Content on Hover or Focus, establishes under the \"Hoverable\" principle that: _The pointer can move over the new content without it disappearing._\r\n\r\n- **Config Property:** `prevail`.\r\n- **Type:** `boolean`.\r\n- **Default:** `true`.\r\n\r\n### Use As Label\r\n\r\nTo establish the same tooltip's text as the actual label to its trigger.\r\n\r\nIt will add an `aria-label` attribute with the same text.\r\n\r\n- **Config Property:** `asLabel`.\r\n- **Type:** `boolean`.\r\n- **Default:** `false`.\r\n\r\n> **NOTE:** Not all HTML elements are allowed to use `aria-label`, so in case the trigger does not allow it, a visually hidden text will be added after it, to keep the text within the content at all times and be reachable to all assistive technologies (such as Screen Readers).\r\n\r\n### Toggle On\r\n\r\nTo establish which keys are allowed to toggle the tooltip's visibility.\r\n\r\n- **Config Property:** `toggleOn`.\r\n- **Type:** `string[]`.\r\n- **From:** `KeyboardEvent.code`.\r\n- **Default:** `['ControlLeft', 'ControlRight']`.\r\n\r\n## The `recalculate()` Method\r\n\r\nTo recalculate the tooltip's position on demand.\r\n\r\nThis can come handy when we face scenarios where the trigger element can move after an interaction (like, by clicking on it) and it changes its original position. The tooltip doesn't know its trigger moved, so we have to force to recalculate by using this method.\r\n\r\nA bit forced example: let's say we have a calendar with the typical \"Previous Month\" and \"Next Month\" buttons, with the current month in between, and all centered in the screen. Unless that current month's wrapper has a fixed width, it will change its size and, therefore, the buttons will change their positions.\r\n\r\nTo access the tooltip, we can use the exported instance from `a11yTooltip`:\r\n\r\n**TypeScript:**\r\n\r\n```typescript\r\ncurrentMonth: number = 0;\r\nreadonly months: string[] = [\r\n    'January', 'February', 'March', 'April', 'May', 'June', 'July',\r\n    'August', 'September', 'October', 'November', 'December'\r\n];\r\n\r\nchangeMonth(monthToAdd: number): void {\r\n    const newMonth: number = this.currentMonth + monthToAdd;\r\n    if (monthToAdd === -1 && newMonth < 0) this.currentMonth = 11;\r\n    else if (newMonth > 11) this.currentMonth = 0;\r\n    else this.currentMonth = newMonth;\r\n}\r\n```\r\n\r\n**Template:**\r\n\r\n```html\r\n<button\r\n    type=\"button\"\r\n    class=\"btn\"\r\n    tooltip=\"Previous Month\"\r\n    [tooltipConfig]=\"{ asLabel: true }\"\r\n    #ttPrev=\"a11yTooltip\"\r\n    (click)=\"changeMonth(-1); ttPrev.recalculate()\">\r\n    <i class=\"fa-solid fa-chevron-left\"></i>\r\n</button>\r\n<div>{{ months[currentMonth] }}</div>\r\n<button\r\n    type=\"button\"\r\n    class=\"btn\"\r\n    tooltip=\"Next Month\"\r\n    [tooltipConfig]=\"{ asLabel: true }\"\r\n    #ttNext=\"a11yTooltip\"\r\n    (click)=\"changeMonth(1); ttNext.recalculate()\">\r\n    <i class=\"fa-solid fa-chevron-right\"></i>\r\n</button>\r\n```\r\n\r\nBy default, the tooltip will stay where it was, being now misaligned from its trigger as you can see in the next example at the left, while the one at the right did recalculate its position and is perfectly aligned to the button.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-recalculate.jpg)\r\n\r\n## The Color Schemes\r\n\r\nThis library uses [Color Scheme package](https://www.npmjs.com/package/@a11y-ngx/color-scheme) as a dependency so you can make use of the two basic color schemes: `light` and `dark` (or more).\r\n\r\n### How to Configure the Color Schemes\r\n\r\nYou can establish all the color related stuff for the preset schemes (`light` and `dark`) or any other you may have added when using the `rootConfig()` method from `A11yColorSchemeModule`.\r\n\r\n- **Config Property:** `colorSchemes`.\r\n- **Type:** `ColorSchemesStyles`.\r\n- **Properties:**\r\n  - `schemes` of type `ColorSchemes`:\r\n    - In here we have to specify each color scheme by its code-name and, within, the properties we want to override (of type `ColorSchemeProperties`):\r\n      - `light`.\r\n      - `dark`.\r\n      - _'code-name'_ (any other).\r\n\r\nLet's say you don't like the default text color for the `light` scheme (`#222`), then you can change it like this:\r\n\r\n```typescript\r\nA11yTooltipModule.rootConfig({\r\n    ...\r\n    safeSpace: { top: 65, left: 50 },\r\n    borderSize: 2,\r\n    ...\r\n    colorSchemes: {\r\n        schemes: {\r\n            light: {\r\n                textColor: '#000',\r\n            },\r\n            dark: {...},\r\n            'red-velvet': {...}, // being 'red-velvet' the code-name\r\n        },\r\n    },\r\n}),\r\n```\r\n\r\n> **NOTES:**\r\n>\r\n> 1. Although `colorSchemes` also includes the `generics` object to define (redundant as it may sound) the generic values (not related to color), that property was removed from here, and you can add those at the _root_ level of the object provided, as shown for the `borderSize` property.\r\n> 2. If you add a color-related property at the _root_ level, it will be treated as _generic_ and will affect all tooltips.\r\n\r\n### How to Force a Scheme\r\n\r\nEven when the color scheme is set to a specific value (globally), you can force a tooltip to use another.\r\n\r\n- **Config Property:** `forceScheme`.\r\n- **Type:** `ColorScheme` (aka `string`, aka _'code-name'_).\r\n\r\nI've added a couple color schemes for testing purposes, called `'red-velvet'` and `'blue-sky'`.\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-force-scheme.jpg)\r\n\r\n### How to add a New Color Scheme\r\n\r\nSince Color Scheme package is a dependency, you can add new schemes if you need to. You can use the `rootConfig()` method on the `A11yColorSchemeModule` in your app.\r\n\r\nThe properties you can configure within the `scheme` object are:\r\n\r\n- `a11yBackgroundColor`\r\n- `a11yTextColor`\r\n- `a11yBorderColor`\r\n- `a11yShadow`\r\n- `a11yShadowColor`\r\n\r\n> **NOTE:** Any property you don't specify, it will use the value defined within `light`.\r\n\r\n```typescript\r\nA11yColorSchemeModule.rootConfig({\r\n    newSchemes: [\r\n        {\r\n            value: 'red-velvet',\r\n            name: 'Red Velvet',\r\n            scheme: {\r\n                a11yBackgroundColor: '#590811',\r\n                a11yTextColor: '#FFEEEE',\r\n                a11yBorderColor: '#995555',\r\n                a11yShadowColor: '#995555',\r\n            },\r\n        }\r\n    ],\r\n}),\r\n```\r\n\r\n## The Use with Image Maps\r\n\r\nImage maps can also be a \"problem\":\r\n\r\n❌ The `<area>` elements have no \"surface\" like a normal element<br />\r\n❌ If the image has been resized after the map was generated (based on its original size, duh!), events like hover and focus will no longer match\r\n\r\nFor the next example, we are working with an image with an original size of 1344px x 768px, downsized to 700px width.\r\n\r\n```html\r\n<img src=\"/assets/images/desktop-map-image.png\" alt=\"\" usemap=\"#image-map\" width=\"700\" />\r\n\r\n<map name=\"image-map\">\r\n    <area tooltip=\"Monitor\" shape=\"poly\" coords=\"322,114,359,370,684,339,1030,367,1064,115,687,84\" href=\"...\"/>\r\n    <area tooltip=\"Laptop\" shape=\"poly\" coords=\"17,338,75,527,117,649,417,542,350,436,302,262\" href=\"...\" />\r\n    <area tooltip=\"Keyboard\" shape=\"poly\" coords=\"485,480,466,627,915,624,887,478\" href=\"...\" />\r\n    <area tooltip=\"Mouse\" shape=\"rect\" coords=\"937,490,1035,590\" href=\"...\" />\r\n    <area tooltip=\"Phone\" shape=\"poly\" coords=\"1119,418,1151,320,1201,338,1168,440\" href=\"...\" />\r\n</map>\r\n```\r\n\r\nAs seen in the next screenshot, there are two issues:\r\n\r\n- The _beautiful_ (for visual purpose) red square is the focus ring for the monitor (since the coordinates of the polygon were generated for its original size), so the focused element is respecting _that_ size\r\n- The tooltip has no \"surface\" to attach to, so it's kind of \"floating around\"\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-image-map-off.jpg)\r\n\r\nTo fix this, you can make use of the [Responsive Image Maps library](https://www.npmjs.com/package/@a11y-ngx/responsive-image-maps) (if you have Image Maps in your website, of course).\r\n\r\n✔️ It will readjust the coordinates for each `<area>` element to the current image size<br />\r\n✔️ The tooltip will make use of the new coordinates to position itself properly\r\n\r\n```typescript\r\nimport { A11yTooltipModule } from '@a11y-ngx/tooltip';\r\nimport { A11yResponsiveImageMapsModule } from '@a11y-ngx/responsive-image-maps';\r\n\r\n@NgModule({\r\n    declarations: [...],\r\n    imports: [\r\n        ...\r\n        A11yTooltipModule,\r\n        A11yResponsiveImageMapsModule,\r\n    ],\r\n})\r\nexport class MyCustomModule { }\r\n```\r\n\r\nNow, we can observe that:\r\n\r\n✔️ The focus ring matches the original coordinates in the new downsized image<br />\r\n✔️ The tooltip is correctly located to its default position/alignment (top-center)\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-image-map-on.jpg)\r\n\r\n## The Use with Abbreviation Elements\r\n\r\nAbbreviations (`<abbr>`) are one of the few elements where using the native `title` attribute is both expected and \"accessible\".\r\n\r\nWhile this is semantically correct, screen readers (as far as I know, all of them) won't read the title at all, that's why the library will add a visually hidden text after the `<abbr>`.\r\n\r\n**Template:**\r\n\r\n```html\r\nGood <abbr title=\"User Experience\">UX</abbr> design focuses on how a product feels,\r\nwhile <abbr title=\"User Interface\">UI</abbr> design focuses on how it looks.\r\nBoth are essential to creating intuitive digital experiences.\r\n```\r\n\r\n**Result for the Tooltip:**\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-abbr.jpg)\r\n\r\n**Result for the NVDA Screen Reader:**\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-abbr-screen-reader.jpg)\r\n\r\n## The Use with Non-Interactive Elements\r\n\r\nIn case you are using the tooltip in a non-interactive element (not recommended), the same thing will happen as with the use of the `<abbr>` element, it will add a visually hidden text after it.\r\n\r\n**Template:**\r\n\r\n```html\r\nYou can use any of the available alignments:\r\n<i class=\"fa-solid fa-align-right\" tooltip=\"Left\"></i>,\r\n<i class=\"fa-solid fa-align-center\" tooltip=\"Center\"></i>,\r\n<i class=\"fa-solid fa-align-right\" tooltip=\"Right\"></i> or\r\n<i class=\"fa-solid fa-align-justify\" tooltip=\"Justified\"></i>.\r\n```\r\n\r\n**Result for the Tooltip:**\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-non-interactive.jpg)\r\n\r\n**Result for the NVDA Screen Reader:**\r\n\r\n![\"\"](https://raw.githubusercontent.com/LDV2k3/a11y-libraries/refs/heads/master/projects/a11y-ngx/tooltip/src/lib/images/example-non-interactive-screen-reader.jpg)\r\n\r\n> **IMPORTANT:** Remember that this is **NOT** recommended, since keyboard users can't reach the tooltip at all. Making the element focusable (`tabindex=\"0\"`) might seem to \"fix\" the keyboard scenario, but it's **NOT** accessible, since users expect that focusable elements to be interactive.\r\n","readmeFilename":"README.md"}