|
@@ -58,6 +58,10 @@ export default {
|
|
|
transition: {
|
|
|
type: String,
|
|
|
default: 'fade-in-linear'
|
|
|
+ },
|
|
|
+ tabindex: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -86,7 +90,7 @@ export default {
|
|
|
if (reference) {
|
|
|
addClass(reference, 'el-popover__reference');
|
|
|
reference.setAttribute('aria-describedby', this.tooltipId);
|
|
|
- reference.setAttribute('tabindex', 0); // tab序列
|
|
|
+ reference.setAttribute('tabindex', this.tabindex); // tab序列
|
|
|
popper.setAttribute('tabindex', 0);
|
|
|
|
|
|
if (this.trigger !== 'click') {
|
|
@@ -113,6 +117,9 @@ export default {
|
|
|
on(reference, 'mouseleave', this.handleMouseLeave);
|
|
|
on(popper, 'mouseleave', this.handleMouseLeave);
|
|
|
} else if (this.trigger === 'focus') {
|
|
|
+ if (this.tabindex < 0) {
|
|
|
+ console.warn('[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key');
|
|
|
+ }
|
|
|
if (reference.querySelector('input, textarea')) {
|
|
|
on(reference, 'focusin', this.doShow);
|
|
|
on(reference, 'focusout', this.doClose);
|