UNPKG

25.4 kBMarkdownView Raw
1Ember-tooltips (and popovers) [![Build Status](https://travis-ci.org/sir-dunxalot/ember-tooltips.svg?branch=master)](https://travis-ci.org/sir-dunxalot/ember-tooltips) [![npm](https://img.shields.io/npm/v/ember-tooltips.svg)](https://www.npmjs.com/package/ember-tooltips) [![Ember Observer Score](http://emberobserver.com/badges/ember-tooltips.svg)](http://emberobserver.com/addons/ember-tooltips)
2======
3
4Render tooltips and popovers on components and other HTML elements using HTMLBars.
5
6## Installation
7
8```
9ember install ember-tooltips
10```
11
12## Upgrading from 2.x
13
14See [UPGRADING-3.x.md](UPGRADING-3.x.md)
15
16## Documentation
17
18Documentation for usage is below:
19
20- [Demo](http://sir-dunxalot.github.io/ember-tooltips/)
21- [Usage](#usage)
22 - [ember-tooltip](#ember-tooltip)
23 - [ember-popover](#ember-popover)
24 - [Targets](#targets)
25- [Options](#options)
26 - [Setting defaults](#setting-defaults)
27- [Actions](#actions)
28- [Testing](#testing)
29 - [Test helpers](#test-helpers)
30- [Accessibility](#accessibility)
31- [Development](#development)
32
33## Usage
34
35This documentation is for the `3.x` version of ember-tooltips. For `2.x` documentation, please refer to the [2.x branch README](https://github.com/sir-dunxalot/ember-tooltips/tree/2.x).
36
37### Ember Tooltip
38
39The easiest way to add a tooltip to any element is with the `{{ember-tooltip}}` component:
40
41```hbs
42{{#my-component}}
43 Hover for more info
44
45 {{ember-tooltip text='Here is more info!'}}
46{{/my-component}}
47```
48
49Or in block form:
50
51```hbs
52{{#my-component}}
53 Hover for more info
54
55 {{#ember-tooltip}}
56 Here is the info in a tooltip!
57 {{/ember-tooltip}}
58{{/my-component}}
59```
60
61The tooltip will always be rendered on its parent element unless you specify the `targetId` attribute:
62
63```hbs
64{{input id='has-info-tooltip'}}
65
66{{#ember-tooltip targetId='has-info-tooltip'}}
67 Here is some more info
68{{/ember-tooltip}}
69```
70
71Tooltips and popovers are lazy rendered. That means the are only rendered in the DOM once the user interacts with the [target element](#targets).
72
73Options can be set on the `{{ember-tooltip}}` as attributes:
74
75```hbs
76{{#my-component}}
77 Click for more info
78
79 {{#ember-tooltip event='click'}}
80 This info will show on click!
81 {{/ember-tooltip}}
82{{/my-component}}
83```
84
85Documentation for supported options is located [here](#options).
86
87### Ember popover
88
89Popovers can be created with the `{{ember-popover}}` component, which is added to apps just like `{{ember-tooltip}}`.
90
91Popovers support the same `target` behavior as tooltips; popovers will render on their parent element unless a `targetId` is supplied.
92
93All the [options](#options) passed to tooltip components can be passed to popover components:
94
95```hbs
96{{#my-component}}
97 Click for more info
98
99 {{#ember-popover event='click'}}
100 This info will show in a popover on click!
101 {{/ember-popover}}
102{{/my-component}}
103```
104
105Popovers also benefit from a `hide` API made publically acessible:
106
107```
108{{#ember-popover as |popover|}}
109 Click <a href {{action 'hide' target=popover}}>here</a> to hide the popover
110{{/ember-popover}}
111```
112
113In addition, a [popoverHideDelay](#popover-hide-delay) option is made available for popovers only.
114
115## Targets
116
117The concept of a 'target' is used through this addon. A target is the element that the tooltip or popover is attached to. Each tooltip or popvers has its own target. Interacting with this target will render and/or show the tooltip or popover.
118
119For example, if you want to show a tooltip over a button when the user hovers over the button, the button is the target. If you want to show a popover over an input when the user focuses on the input, the input is the target.
120
121## Options
122
123Options are set as attributes on the tooltip/popover components. Current tooltip/popover properties this addon supports are:
124
125- [class](#class)
126- [delay](#delay)
127- [delayOnChange](#delay-on-change)
128- [duration](#duration)
129- [effect](#effect)
130- [event](#event)
131- [hideDelay (popover only)](#hide-delay)
132- [hideOn](#hide-on)
133- [isShown](#is-shown)
134- [popperOptions](#popper-options)
135- [side](#side)
136- [showOn](#show-on)
137- [spacing](#spacing)
138- [text (tooltip only)](#text)
139
140#### Class
141
142| Type | String |
143|---------|---------|
144| Default | none |
145
146Adds a class to any tooltip:
147
148```hbs
149{{ember-tooltip class='tooltip-warning'}}
150```
151
152#### Delay
153
154| Type | Number |
155|---------|---------|
156| Default | 0 |
157
158Delays showing the tooltip by the given number of milliseconds.
159
160```hbs
161{{!--Delays the show animation by 500ms--}}
162
163{{ember-tooltip delay=500}}
164```
165
166This does not affect the hiding of the tooltip. See also, [delayOnChange](#delay-on-change).
167
168#### Delay on change
169
170| Type | Boolean |
171|---------|---------|
172| Default | true |
173
174Whether or not to enforce the delay even when the user transitions their cursor between multiple target elements with tooltips.
175
176See this animation for a visual explanation:
177
178![](https://cloud.githubusercontent.com/assets/669410/15400803/d99f671e-1dba-11e6-8183-8b160cbcda10.gif)
179
180```hbs
181{{!--Forces delay to be enforced when the user skips
182between elements with tooltips--}}
183
184{{ember-tooltip delayOnChange=true}}
185```
186
187#### Duration
188
189| Type | Number |
190|---------|---------|
191| Default | 0 |
192
193Sets the duration for which the tooltip will be open, in milliseconds. When the tooltip has been opened for the duration set it will hide itself.
194
195The user will still hide the tooltip if the hide event occurs before the duration expires.
196
197```hbs
198{{!-- Closes the tooltip after 1000ms--}}
199
200{{ember-tooltip duration=1000}}
201```
202
203Leave as `0` if you wish for the tooltip to remain open indefinitely.
204
205#### Effect
206
207| Type | String |
208|---------|---------|
209| Default | 'slide' |
210
211Sets the animation used to show and hide the tooltip. Possible options are:
212
213- `'fade'`
214- `'slide'`
215- `'none'`
216
217```hbs
218{{ember-tooltip effect='slide'}}
219```
220
221#### Event
222
223| Type | String |
224|---------|---------|
225| Default | 'hover' |
226
227The event that the tooltip will hide and show for. Possible options are:
228
229- `'hover'`
230- `'click'`
231- `'focus'` (hides on blur)
232- `'none'`
233
234```hbs
235{{ember-tooltip event='click'}}
236```
237
238This event is overwritten by the individual [`hideOn`](#hide-on) and [`showOn`](#show-on) properties. In effect, setting `event` sets `hideOn` and `shownOn` for you.
239
240The tooltip can also be shown programatically by passing in the `isShown` property, [documented here](#is-shown).
241
242#### Hide on
243
244| Type | String |
245|---------|---------|
246| Default | 'none' |
247
248Sets the event that the tooltip will hide on. This overwrites any event set with the [event](#event) option.
249
250This can be any javascript-emitted event.
251
252```hbs
253{{!--This tooltip will hide on mouseleave, NOT click--}}
254
255{{ember-tooltip
256 event='click'
257 hideOn='mouseleave'
258}}
259```
260
261Usually, you'll use the `event` option, which sets `showOn` and `hideOn` automatically, instead of this option.
262
263This option does not affect the event the tooltip shows on. That is set by the [showOn](#show-on) option. This will override [the event property](#event) in deciding when the tooltip is hidden.
264
265#### Popper options
266
267| Type | Object |
268|---------|--------|
269| Default | null |
270
271Sets the `popperOptions` on the underlying `tooltip.js` instance. Currently, only
272overriding `modifiers` is supported. See popper.js documentation for
273[more information on available modifiers](https://popper.js.org/popper-documentation.html#modifiers).
274
275This can be used to customize various aspects of tooltip rendering and override
276certain `popper.js` defaults set by `ember-tooltips`. For example, using a tooltip
277inside of an absolutely or relatively positioned container with overflow constraints,
278you may want to disable `preventOverflow.escapeWithReference`.
279
280```js
281// app/components/some-component.js`
282import Component from '@ember/component';
283
284export default Component.extend({
285 popperOptions: {
286 modifiers: {
287 preventOverflow: {
288 escapeWithReference: false
289 }
290 }
291 },
292 // ... other stuff
293});
294```
295
296```hbs
297{{!-- app/templates/components/some-component.hbs` --}}
298
299<div class="my-scrollable-container">
300 {{#each items as |item|}}
301 <div class="row">
302 {{item.text}}
303 {{ember-tooltip text=item.tooltip popperOptions=popperOptions}}
304 </div>
305 {{/each}}
306</div>
307```
308
309Note that `popperOptions` is only applied during tooltip creation and that it is
310not reapplied if the value changes after the tooltip is rendered.
311
312#### Side
313
314| Type | String |
315|---------|---------|
316| Default | 'top' |
317
318Sets the side the tooltip will render on.
319
320Possible options are:
321
322- `'top'`
323- `'right'`
324- `'bottom'`
325- `'left'`
326
327In addition, you may also specify `-start` and `-end` variants [supported by Popper.js](https://popper.js.org/popper-documentation.html#Popper.placements).
328e.g. `top-start` to position the tooltip from the top-left or `right-end` to
329position from the bottom right.
330
331```hbs
332{{!--The tooltip will render on the right of the target element--}}
333
334{{ember-tooltip
335 side='right'
336}}
337```
338
339#### Show on
340
341| Type | String |
342|---------|---------|
343| Default | 'none' |
344
345Sets the event that the tooltip will show on. This overwrites any event set with the [event](#event) option.
346
347This can be any javascript-emitted event.
348
349```hbs
350{{!--This tooltip will show on click, NOT hover--}}
351
352{{ember-tooltip
353 showOn='click'
354}}
355```
356
357Usually, you'll use the `event` option, which sets `showOn` and `hideOn` automatically, instead of this option.
358
359This opeion does not affect the event the tooltip hides on. That is set by the [hideOn](#hide-on) option. This will override [the event property](#event) in deciding when the tooltip is shown.
360
361#### Spacing
362
363| Type | Number |
364|---------|---------|
365| Default | 10 |
366
367Sets the number of pixels the tooltip will render from the target element. A higher number will move the tooltip further from the target. This can be any number.
368
369```hbs
370{{!--Render the tooltip 20px from the target element--}}
371{{ember-tooltip spacing=20}}
372```
373
374#### Text
375
376| Type | String |
377|---------|---------|
378| Default | null |
379
380Sets the text of any tooltip without needing the tooltip to be written in block form.
381
382```hbs
383{{#my-component}}
384 Hover for more info
385
386 {{ember-tooltip text='Here is more info!'}}
387{{/my-component}}
388```
389
390#### Is Shown
391
392| Type | Boolean |
393|---------|---------|
394| Default | false |
395
396Gives you a programatic way to hide and show a tooltip. Set this value to `true` to manually show the tooltip.
397
398This can be useful alongside `event='none'` when you only want to toolip to show when you specific and not based on an user action.
399
400```hbs
401{{!--Binds the tooltip visibility to the showTooltip property--}}
402{{ember-tooltip isShown=showTooltip event='none'}}
403```
404
405#### Hide delay
406
407| Type | Number |
408|---------|---------|
409| Default | 250 |
410
411**POPOVER ONLY:** The number of milliseconds before the popover will hide after the user hovers away from the popover and the popover target. This is only applicable when `event='hover'`.
412
413```hbs
414{{ember-popover event='hover' hideDelay=300}}
415```
416
417![popover-hover](https://cloud.githubusercontent.com/assets/7050871/18113238/e010ee64-6ee2-11e6-9ff1-a0c674a6d702.gif)
418
419### Setting Defaults
420
421You can set the default for any option by extending the `{{ember-tooltip}}` or `{{ember-popover}}` component:
422
423```js
424{{!--your-app/components/ember-tooltip}}--}}
425
426import EmberTooltipComponent from 'ember-tooltips/components/ember-tooltip';
427
428export default EmberTooltipComponent.extend({
429 effect: 'fade',
430 side: 'bottom',
431});
432```
433
434## Actions
435
436Four actions are available for you to hook onto through the tooltip/popover lifecycle:
437
438```hbs
439{{ember-tooltip
440 onDestroy=(action 'onDestroy')
441 onHide=(action 'onHide')
442 onRender=(action 'onRender')
443 onShow=(action 'onShow')
444}}
445```
446
447## Testing
448
449### Test helpers
450
451This addon exposes testing helpers which can be used inside of the consuming app's acceptance and integration tests. We use a tooltip-centric naming convention but these can also be used to test popovers.
452
453Publically available test helpers are:
454
455- [assertTooltipContent()](#asserttooltipcontent)
456- [assertTooltipRendered()](#asserttooltiprendered)
457- [assertTooltipNotRendered()](#asserttooltipnotrendered)
458- [assertTooltipVisible()](#asserttooltipvisible)
459- [assertTooltipNotVisible()](#asserttooltipnotvisible)
460- [assertTooltipSide()](#asserttooltipside)
461- [assertTooltipSpacing()](#asserttooltipspacing)
462
463All assert helpers require `assert` to be passed as the first param and some accept a second, optional param for additional test options. For detailed usage instructions and examples, see the documentation for each test helper below.
464
465All test helpers can be imported from the following path:
466
467```js
468'ember-tooltips/test-support';
469```
470
471For example:
472
473```js
474// appname/tests/integration/components/some-component.js
475
476import { module, test } from 'qunit';
477import { setupRenderingTest } from 'ember-qunit';
478import { render, triggerEvent } from '@ember/test-helpers';
479import hbs from 'htmlbars-inline-precompile';
480
481import { assertTooltipRendered } from 'ember-tooltips/test-support';
482
483module('Integration | Component | Some component', function(hooks) {
484 setupRenderingTest(hooks);
485
486 test('ember-tooltip renders', async function(assert) {
487
488 await render(hbs`{{ember-tooltip isShown=true}}`);
489
490 assertTooltipRendered(assert);
491 });
492});
493```
494
495#### assertTooltipContent()
496
497Asserts that a tooltip or popover has content that matches a given string.
498
499```js
500import { assertTooltipContent } from 'ember-tooltips/test-support';
501
502test('Example test', async function(assert) {
503
504 await render(hbs`{{ember-tooltip text='More info' isShown='true'}}`);
505
506 assertTooltipContent(assert, {
507 contentString: 'More info',
508 });
509});
510```
511
512The [options hash](#test-helper-options) accepts:
513
514- [`contentString`](#test-helper-option-contentstring)
515- [`selector`](#test-helper-option-selector)
516
517#### assertTooltipRendered()
518
519Asserts that a tooltip or popover has been rendered in the DOM.
520
521```js
522import { render, triggerEvent } from '@ember/test-helpers';
523import { assertTooltipRendered } from 'ember-tooltips/test-support';
524
525test('Example test', async function(assert) {
526
527 await render(hbs`{{ember-tooltip}}`);
528
529 await triggerEvent(this.element, 'mouseenter');
530
531 assertTooltipRendered(assert);
532});
533```
534
535Please note, `assertTooltipRendered()` does not assert that the tooltip or popover is visible to the user - use [assertTooltipVisible()](#asserttooltipvisible) for that.
536
537Given this addon's lazy rendering capabilities (explained in [Targets](#targets)), tooltips will not be rendered until the target is interacted with.
538
539The [options hash](#test-helper-options) accepts:
540
541- [`selector`](#test-helper-option-selector)
542
543#### assertTooltipNotRendered()
544
545Asserts that a tooltip or popover has not been rendered in the DOM.
546
547Why is this test helper useful? Well, given this addon's lazy rendering capabilities (explained in [Targets](#targets)), tooltips may not be rendered until the target is interacted with.
548
549```js
550import { render, triggerEvent } from '@ember/test-helpers';
551import { assertTooltipNotRendered } from 'ember-tooltips/test-support';
552
553test('Example test', async function(assert) {
554
555 await render(hbs`{{ember-tooltip}}`);
556
557 assertTooltipNotRendered(assert);
558});
559```
560
561This helper does not assert that the tooltip or popover is not visible to the user. The assertion will fail if the tooltip or popover is not visible to the user but is still rendered in the DOM. If you want to assert that a tooltip or popover is not visible once it's rendered in the DOM, use [assertTooltipNotVisible()](#asserttooltipnotvisible).
562
563The [options hash](#test-helper-options) accepts:
564
565- [`selector`](#test-helper-option-selector)
566
567#### assertTooltipVisible()
568
569Asserts that a tooltip or popover is visible.
570
571For example:
572
573```js
574import { render, triggerEvent } from '@ember/test-helpers';
575import { assertTooltipVisible } from 'ember-tooltips/test-support';
576
577test('Example test', async function(assert) {
578
579 await render(hbs`{{ember-tooltip}}`);
580
581 await triggerEvent(this, this.element);
582
583 assertTooltipVisible(assert);
584});
585```
586
587You may use this helper with a variety of different user interactions. Here's an example that asserts that a tooltip is shown when the user focusses on an input:
588
589```js
590import { render, triggerEvent } from '@ember/test-helpers';
591import { assertTooltipVisible } from 'ember-tooltips/test-support';
592
593test('Example test', async function(assert) {
594
595 await render(hbs`
596 <input id="url-input">
597 {{ember-tooltip targetId='url-input'}}
598 `);
599
600 await triggerEvent($('#url-input')[0], 'focus');
601
602 /* Asserts that the tooltip is made visible when the user focuses on the input */
603
604 assertTooltipVisible(assert);
605});
606```
607
608The [options hash](#test-helper-options) accepts:
609
610- [`selector`](#test-helper-option-selector)
611
612#### assertTooltipNotVisible()
613
614Asserts that a tooltip or popover is not visible.
615
616This helper is usually used in conjunction with [triggerTooltipTargetEvent()](#triggertooltiptargetevent) to assert that a particular user interaction hides a tooltip to the user.
617
618For example:
619
620```js
621import { render, triggerEvent } from '@ember/test-helpers';
622import {
623 assertTooltipNotVisible,
624 assertTooltipVisible,
625} from 'ember-tooltips/test-support';
626
627test('Example test', async function(assert) {
628
629 await render(hbs`{{ember-tooltip}}`);
630
631 const { element } = this;
632
633 /* Hover over the target to show the tooltip... */
634
635 await triggerEvent(element, 'mouseenter');
636
637 assertTooltipVisible(assert);
638
639 /* Stop hovering over the target in order to hide the tooltip... */
640
641 await triggerEvent(element, 'mouseleave');
642
643 assertTooltipNotVisible(assert);
644});
645```
646
647The [options hash](#test-helper-options) accepts:
648
649- [`selector`](#test-helper-option-selector)
650
651#### assertTooltipSide()
652
653Asserts that a tooltip or popover is rendered on the correct side of [the target](#targets).
654
655This helper tests [the side option](#side) that can be passed to tooltips and popovers.
656
657An options hash is required and it must contain a `side` property. For example:
658
659```js
660import { assertTooltipSide } from 'ember-tooltips/test-support';
661
662test('Example test', async function(assert) {
663
664 await render(hbs`{{ember-tooltip side='right' isShown=true}}`);
665
666 /* Asserts that the tooltip is rendered but not shown when the user hovers over the target, which is this test's element */
667
668 assertTooltipSide(assert, {
669 side: 'right',
670 });
671});
672```
673
674The [options hash](#test-helper-options) accepts:
675
676- [`selector`](#test-helper-option-selector)
677- [`side`](#test-helper-option-side)
678- [`targetSelector`](#test-helper-option-targetselector)
679
680#### assertTooltipSpacing()
681
682Asserts that a tooltip or popover is rendered a given number of pixels from [the target](#targets).
683
684This helper tests [the spacing option](#spacing) that can be passed to tooltips and popovers.
685
686An options hash is required and it must contain `spacing` and `side` properties. For example:
687
688```js
689import { assertTooltipSpacing } from 'ember-tooltips/test-support';
690
691test('Example test', async function(assert) {
692
693 await render(hbs`{{ember-tooltip spacing=35 isShown=true}}`);
694
695 /* Asserts that the tooltip is rendered but not shown when the user hovers over the target, which is this test's element */
696
697 assertTooltipSpacing(assert, {
698 side: 'right', // Side is required
699 spacing: 35,
700 });
701});
702```
703
704The [options hash](#test-helper-options) accepts:
705
706- [`selector`](#test-helper-option-selector)
707- [`side`](#test-helper-option-side)
708- [`spacing`](#test-helper-option-spacing)
709- [`targetSelector`](#test-helper-option-targetselector)
710
711### Test helper options
712
713Most test helpers accept a second, optional param called `options`. This is an object you can pass that customizes various options in a test. The properties you can pass via `options` for each test helper is listed above. Below you will find more information for each property.
714
715- [Content string](#test-helper-option-contentstring)
716- [Selector](#test-helper-option-selector)
717- [Side](#test-helper-option-side)
718- [Spacing](#test-helper-option-spacing)
719- [Target selector](#test-helper-option-targetselector)
720
721#### Test helper option: `contentString`
722
723The content string you expect the tooltip or popover to have.
724
725| Type | String |
726|---------|---------|
727| Default | null |
728
729Usage example:
730
731```js
732import { assertTooltipContent } from 'ember-tooltips/test-support';
733
734test('Example test', async function(assert) {
735
736 await render(hbs`{{ember-tooltip text='More info' isShown='true'}}`);
737
738 assertTooltipContent(assert, {
739 contentString: 'More info',
740 });
741});
742```
743
744#### Test helper option: `selector`
745
746The selector of the tooltip or popover you are testing.
747
748If more than one tooltip or popover is found in the DOM when you run an assertion, you will be asked to specify this.
749
750| Type | String |
751|---------|---------|
752| Default | `'.ember-tooltip, .ember-popover'` |
753
754Usage example:
755
756```js
757import { render, triggerEvent } from '@ember/test-helpers';
758import { assertTooltipVisible } from 'ember-tooltips/test-support';
759
760test('Example test', async function(assert) {
761
762 await render(hbs`
763 {{ember-tooltip}}
764 {{ember-tooltip class="differentiator"}}
765 `);
766
767 await triggerEvent(this, this.element);
768
769 assertTooltipVisible(assert, {
770 selector: '.differentiator', // Or whatever class you added to the desired tooltip
771 });
772});
773```
774
775#### Test helper option: `side`
776
777The value for the tooltip or popover's [`side` option](#side) that you are asserting.
778
779| Type | String |
780|---------|---------|
781| Default | `null` |
782
783For example, if you specify for the tooltip or popover be shown on the right of the target using `side='right'`, you will pass `side: 'right'` in assertions that test side. Here is the code for this example:
784
785```js
786import { assertTooltipSide } from 'ember-tooltips/test-support';
787
788test('Example test', async function(assert) {
789
790 await render(hbs`{{ember-tooltip side='right' isShown=true}}`);
791
792 /* Asserts that the tooltip is rendered but not shown when the user hovers over the target, which is this test's element */
793
794 assertTooltipSide(assert, {
795 side: 'right',
796 });
797});
798```
799
800#### Test helper option: `spacing`
801
802The value for the tooltip or popover's [`spacing` option](#spacing) that you are asserting. Specify as a number of pixels expected (without a `px` unit).
803
804| Type | Number |
805|---------|---------|
806| Default | `null` |
807
808For example, if you specify for the tooltip or popover be shown on the right of the target using `side='right'`, you will pass `side: 'right'` in assertions that test side. Here is the code for this example:
809
810```js
811import { assertTooltipSide } from 'ember-tooltips/test-support';
812
813test('Example test', async function(assert) {
814
815 await render(hbs`{{ember-tooltip spacing=35 isShown=true}}`);
816
817 /* Asserts that the tooltip is rendered but not shown when the user hovers over the target, which is this test's element */
818
819 assertTooltipSide(assert, {
820 side: 'right', // Side is required
821 spacing: 35,
822 });
823});
824```
825
826#### Test helper option: `targetSelector`
827
828The selector of the target element of the tooltip or popover you are testing.
829
830If more than one tooltip or popover is found in the DOM with a particular selector
831when you run an assertion, you will be asked to specify this.
832
833| Type | String |
834|---------|---------|
835| Default | `'.ember-tooltip-target, .ember-popover-target'` |
836
837Usage example:
838
839```js
840import { render, triggerEvent } from '@ember/test-helpers';
841import { assertTooltipVisible } from 'ember-tooltips/test-support';
842
843test('Example test', async function(assert) {
844
845 await render(hbs`
846 <div class="target-a">
847 {{ember-tooltip class="common-tooltip" side='top' isShown=true text='Hi' effect='none'}}
848 </div>
849 <div class="target-b">
850 {{ember-tooltip class="common-tooltip" side='left' isShown=true text='Bye' effect='none'}}
851 </div>
852 `);
853
854 await triggerEvent(this, this.element);
855
856 assertTooltipVisible(assert, {
857 targetSelector: '.target-b', // Or whatever class you added to the target element
858 });
859});
860```
861
862## Accessibility
863
864This addon aims to meet 508 compliance.
865
866Elements with tooltips are given a `tabindex` attribute and when the element receives focus, the tooltip will show.
867
868Additionally, the `aria-describedby`, `title`, `id`, and `role` attributes are managed by this addon.
869
870There is always room for improvement and PRs to improve accessibility are welcome.
871
872## Development
873
874This project is maintained by:
875
876[![Duncan Walker](https://avatars1.githubusercontent.com/u/4495352?s=70&v=4)](https://github.com/sir-dunxalot) | [![Max Fierke](https://avatars3.githubusercontent.com/u/354236?s=70&v=4)](https://github.com/maxfierke) |
877--- | --- |
878[Duncan Walker](https://github.com/sir-dunxalot) | [Max Fierke](https://github.com/maxfierke) |
879
880All PRs and issues are welcome to the following branches:
881
882- `master` for `3.x` improvements and bug fixes
883- `2.x` for `2.x` improvements and bug fixes
884
885Before starting work on a PR, please read the quick guide, [CONTRIBUTING](https://github.com/sir-dunxalot/ember-tooltips/blob/master/CONTRIBUTING.md), to save you time and energy!
886
887## Maintainer information
888
889To release an update to the demo app (for maintainers only):
890
891```sh
892git checkout master # make sure you're on master branch
893ember github-pages:commit --message "Some commit message" # Builds the app
894git push origin gh-pages:gh-pages # Deploys the app
895```