Remove focusability on hidden popover in subject input

This commit is contained in:
tusooa 2025-03-22 18:13:28 -04:00
commit 882a80b04f
No known key found for this signature in database
GPG key ID: 42AEC43D48433C51
5 changed files with 31 additions and 3 deletions

View file

@ -1,3 +1,4 @@
/* global process */
const Popover = {
name: 'Popover',
props: {
@ -48,6 +49,12 @@ const Popover = {
// Use styled button (to avoid nested buttons)
normalButton: Boolean,
// Whether to hide the trigger totally
hideTrigger: {
type: Boolean,
default: false,
},
triggerAttrs: {
type: Object,
default: {}
@ -79,6 +86,26 @@ const Popover = {
childrenShown: new Set()
}
},
computed: {
allTriggerAttrs () {
if (process.env.NODE_ENV === 'development') {
if ('aria-hidden' in this.triggerAttrs) {
throw new Error('Do not use aria-hidden in triggerAttrs. Instead set hideTrigger to true')
}
}
const attrs = {
...this.triggerAttrs,
}
if (this.hideTrigger) {
attrs['aria-hidden'] = true
attrs.tabindex = 1
}
return attrs
}
},
methods: {
setAnchorEl (el) {
this.anchorEl = el