Skip to content
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

Drawer closes prematurely when activating controls inside it by keyboard #619

Open
hanshillen opened this issue Jan 31, 2025 · 0 comments · May be fixed by #621
Open

Drawer closes prematurely when activating controls inside it by keyboard #619

hanshillen opened this issue Jan 31, 2025 · 0 comments · May be fixed by #621
Assignees
Labels

Comments

@hanshillen
Copy link
Contributor

When activating a button or a link inside the drawer using a keyboard, the drawer closes prematurely and the focused item does not get activated.

This is caused by the fact that the onShadowClicked handler is set to handle the click event, which also fires for keyboard-activated links and buttons.

this.el.addEventListener('click', this.onShadowClicked, { capture: true });

onShadowClicked uses the event's mouse coordinates to determine whether the click happened outside the dialog, Since key events have clientX and clientY set to 0, the handler assumes the click was outside the drawer and closes it.

Easiest solution would be to instead listen for mousedown instead, or otherwise check first that the event is not a key event (e.g. by returning when clientX and ClientY are 0)

To reproduce:

Set up a course with adapt-contrib-resources. With the drawer open, tab to a filter button or resource item, and press Enter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs Reviewing
Development

Successfully merging a pull request may close this issue.

2 participants