Vue Tooltip - Accessibility

Accessibility Features Overview

NOTE
The overall accessibility level of your application depends on the Tooltip features that you use.
Accessibility Requirement Support Level
Right-to-Left Support
Keyboard Navigation Support
Screen Reader Support
Contrast Color Theme
Mobile Device Support
Lighthouse Accessibility Validation
Axe Accessibility Validation
WAVE Accessibility Validation
Section 508 Support
WCAG 2.x Support
  • - All component features meet the requirement
  • - Some component features may not meet the requirement
  • - Accessibility requirement is not supported

Accessibility Standards Compliance

The Tooltip component complies to all Section 508 and WCAG 2.x standards criteria.

Screen Reader Support

The Tooltip component supports screen readers and complies to WAI-ARIA standards.

The default ARIA role for Tooltip is tooltip. If you put focusable content inside Tooltip, you may want to change the role to dialog. To implement this functionality, use the onShowing event handler:

jQuery
index.js
const tooltip = $('#tooltip').dxTooltip({
    // ...
    onShowing: function (e) {
        var $overlayContent = $(e.component.content()).parent()
        $overlayContent.attr("role", "dialog");
    },
}).dxTooltip('instance');
Angular
app.component.html
app.component.ts
<dx-tooltip ...
    (onShowing)="onShowingHandler($event)"
>
</dx-tooltip>
import { Component } from "@angular/core";

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    onShowingHandler(e) {
        const overlayContent = e.component.content().parentElement;
        overlayContent.setAttribute("role", "dialog");
    }
}
Vue
App.vue
<template>
<DxTooltip ...
    @showing="onShowingHandler"
/>
</template>

<script>
import { DxTooltip } from 'devextreme-vue/tooltip';

export default {
    components: {
        DxTooltip
    },
    methods: {
        onShowingHandler(e) {
            const overlayContent = e.component.content().parentElement;
            overlayContent.setAttribute("role", "dialog");
        },
    },
};
</script>
React
App.js
import React from 'react';
import Tooltip from 'devextreme-react/tooltip';

const onShowingHandler = (e) => {
    const overlayContent = e.component.content().parentElement;
    overlayContent.setAttribute("role", "dialog");
};

const App = () => {
    return (
        <Tooltip ...
            onShowing={onShowingHandler}
        />
    );
};

export default App;

Accessibility readers do not notify users when the Tooltip is opened since it is not a focusable element. To receive reader notifications for an open dialog, programmatically focus an element in Tooltip after its activation:

jQuery
index.js
$('#tooltip').dxTooltip({
    // ...
    contentTemplate: () => '<div id="content" tabIndex="1">Content template</div>',
    onShown: function (e) {
        $('#content').focus();
    },
});
Angular
app.component.html
app.component.ts
<dx-tooltip ...
    (onShown)="onShownHandler($event)"
>
    <div #contentElement id="content" tabindex="1">
        Content template
    </div>
</dx-tooltip>
import { Component, ElementRef, ViewChild } from "@angular/core";

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    @ViewChild('contentElement') contentElement!: ElementRef;

    onShownHandler(e) {
        this.contentElement.nativeElement.focus();
    }
}
Vue
App.vue
<template>
<DxTooltip ...
    @shown="onShownHandler"
>
    <div id="content" tabindex="1" ref="contentRef">
        Content template
    </div>
</DxTooltip>
</template>

<script>
import { DxTooltip } from 'devextreme-vue/tooltip';

export default {
    components: {
        DxTooltip
    },
    methods: {
        onShownHandler() {
            if (this.contentRef) {
                this.contentRef.focus();
            }
        },
    },
    mounted() {
        this.contentRef = this.$refs.contentRef;
    },
};
</script>
React
App.js
import React, { useRef } from 'react';
import Tooltip from 'devextreme-react/tooltip';

const App = () => {
    const contentRef = useRef(null);

    const onShownHandler = () => {
        if (contentRef.current) {
            contentRef.current.focus();
        }
    };

    return (
        <Tooltip ...
            onShown={onShownHandler}
        >
            <div id="content" tabIndex="1" ref={contentRef}>
                Content template
            </div>
        </Tooltip>
    );
};

export default App;