Fixed #3512 - DropdownMenu: Disabled dropdown can still be opened with screen reader
parent
c3c3edcde8
commit
df3f1ca5a9
|
@ -407,6 +407,11 @@ export default {
|
||||||
}, 0); // For ScreenReaders
|
}, 0); // For ScreenReaders
|
||||||
},
|
},
|
||||||
onFocus(event) {
|
onFocus(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
// For ScreenReaders
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.dirty && this.completeOnFocus) {
|
if (!this.dirty && this.completeOnFocus) {
|
||||||
this.search(event, event.target.value, 'focus');
|
this.search(event, event.target.value, 'focus');
|
||||||
}
|
}
|
||||||
|
@ -424,6 +429,12 @@ export default {
|
||||||
this.$emit('blur', event);
|
this.$emit('blur', event);
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
case 'ArrowDown':
|
case 'ArrowDown':
|
||||||
this.onArrowDownKey(event);
|
this.onArrowDownKey(event);
|
||||||
|
@ -529,6 +540,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMultipleContainerFocus() {
|
onMultipleContainerFocus() {
|
||||||
|
if (this.disabled) {
|
||||||
|
// For ScreenReaders
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.focused = true;
|
this.focused = true;
|
||||||
},
|
},
|
||||||
onMultipleContainerBlur() {
|
onMultipleContainerBlur() {
|
||||||
|
@ -536,6 +552,12 @@ export default {
|
||||||
this.focused = false;
|
this.focused = false;
|
||||||
},
|
},
|
||||||
onMultipleContainerKeyDown(event) {
|
onMultipleContainerKeyDown(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
case 'ArrowLeft':
|
case 'ArrowLeft':
|
||||||
this.onArrowLeftKeyOnMultiple(event);
|
this.onArrowLeftKeyOnMultiple(event);
|
||||||
|
|
|
@ -278,6 +278,11 @@ export default {
|
||||||
}, 0); // For ScreenReaders
|
}, 0); // For ScreenReaders
|
||||||
},
|
},
|
||||||
onFocus(event) {
|
onFocus(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
// For ScreenReaders
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.focused = true;
|
this.focused = true;
|
||||||
this.$emit('focus', event);
|
this.$emit('focus', event);
|
||||||
},
|
},
|
||||||
|
|
|
@ -397,6 +397,11 @@ export default {
|
||||||
}, 0); // For ScreenReaders
|
}, 0); // For ScreenReaders
|
||||||
},
|
},
|
||||||
onFocus(event) {
|
onFocus(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
// For ScreenReaders
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.focused = true;
|
this.focused = true;
|
||||||
this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
|
this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
|
||||||
this.overlayVisible && this.scrollInView(this.focusedOptionIndex);
|
this.overlayVisible && this.scrollInView(this.focusedOptionIndex);
|
||||||
|
@ -409,6 +414,12 @@ export default {
|
||||||
this.$emit('blur', event);
|
this.$emit('blur', event);
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const metaKey = event.metaKey || event.ctrlKey;
|
const metaKey = event.metaKey || event.ctrlKey;
|
||||||
|
|
||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
|
|
|
@ -412,6 +412,11 @@ export default {
|
||||||
}, 0); // For ScreenReaders
|
}, 0); // For ScreenReaders
|
||||||
},
|
},
|
||||||
onFocus(event) {
|
onFocus(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
// For ScreenReaders
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.focused = true;
|
this.focused = true;
|
||||||
this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
|
this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
|
||||||
this.overlayVisible && this.scrollInView(this.focusedOptionIndex);
|
this.overlayVisible && this.scrollInView(this.focusedOptionIndex);
|
||||||
|
@ -424,6 +429,12 @@ export default {
|
||||||
this.$emit('blur', event);
|
this.$emit('blur', event);
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const metaKey = event.metaKey || event.ctrlKey;
|
const metaKey = event.metaKey || event.ctrlKey;
|
||||||
|
|
||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
|
|
Loading…
Reference in New Issue