File tree 3 files changed +8
-2
lines changed
3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 155
155
:placement =" placement"
156
156
:auto-hide =" isAutoHiding"
157
157
:disabled =" !isEnabled"
158
+ aria-id =" test-popper-aria-id"
158
159
open-class =" is-open"
159
160
>
160
161
<button class =" tooltip-target b3 popover-btn" >Click me</button >
Original file line number Diff line number Diff line change @@ -165,6 +165,10 @@ export default {
165
165
type: [String , Array ],
166
166
default : () => directive .options .popover .defaultOpenClass ,
167
167
},
168
+
169
+ ariaId: {
170
+ default: null ,
171
+ },
168
172
},
169
173
170
174
data () {
@@ -182,7 +186,7 @@ export default {
182
186
},
183
187
184
188
popoverId () {
185
- return ` popover_${ this .id } `
189
+ return ` popover_${ this .ariaId != null ? this . ariaId : this . id } `
186
190
},
187
191
},
188
192
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ export default class Tooltip {
51
51
* [offset docs](https://popper.js.org/popper-documentation.html)
52
52
* @param {Object } options.popperOptions={} - Popper options, will be passed directly to popper instance. For more information refer to Popper.js'
53
53
* [options docs](https://popper.js.org/popper-documentation.html)
54
+ * @param {string } [options.ariaId] Id used for accessibility
54
55
* @return {Object } instance - The generated tooltip instance
55
56
*/
56
57
constructor ( reference , options ) {
@@ -221,7 +222,7 @@ export default class Tooltip {
221
222
const tooltipNode = tooltipGenerator . childNodes [ 0 ]
222
223
223
224
// add unique ID to our tooltip (needed for accessibility reasons)
224
- tooltipNode . id = `tooltip_${ Math . random ( ) . toString ( 36 ) . substr ( 2 , 10 ) } `
225
+ tooltipNode . id = this . options . ariaId || `tooltip_${ Math . random ( ) . toString ( 36 ) . substr ( 2 , 10 ) } `
225
226
226
227
// Initially hide the tooltip
227
228
// The attribute will be switched in a next frame so
You can’t perform that action at this time.
0 commit comments