-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pointer-activated menu should not focus the first element in the menu as default? #174
Comments
Hmm, differentiating between wether a popover was click-triggered or keyboard-triggered may be theoretically impossible to detect from a modifier on the menu alone…? :/ |
The only thing I can think is to set up an event listener on the element with popovertarget=element.id. Something along these lines: const triggerElement = document.querySelector(`[popovertarget=${element.id}]`);
if (triggerElement) {
triggerElement.addEventListener('click', (event) => {
menu[FOCUS_ON_OPEN] = false;
});
triggerElement.addEventListener('keydown', (event) => {
menu[FOCUS_ON_OPEN] = true;
});
} |
For references use the best practices and then verify the samples. Some of them are ~15yrs old and haven't been updated (yet). The best practices are listing the up-to-date interactions, so the ones I used: Keyboard Interaction >
Keyboard Interaction
But already when implementing this, I realized the spec leaves some options open for implementors to make a decision. I think, the Some of this is also encoded in different roles, e.g. My thinking here is:
Can you maybe collect some of the behaviors you wanna see/want to configure? Are you looking for a Happy to hear :) |
Ah I see now. I've checked a Technically a challenge, as the popover is not part of |
yeah, a bit unfortunate, but the only thing i could think of was to add a listener to the element referring to the popover with the const triggerElement = document.querySelector(`[popovertarget=${element.id}]`) (or if a reference element selector is passed in). |
With
aria-voyager
both click and keybord interaction ends up with the first item in the list being focused. This felt a bit unexpected.The text was updated successfully, but these errors were encountered: