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

Dialog Cards being auto-scrolled to when used as an embed #102

Open
keevan opened this issue Jul 13, 2021 · 0 comments
Open

Dialog Cards being auto-scrolled to when used as an embed #102

keevan opened this issue Jul 13, 2021 · 0 comments

Comments

@keevan
Copy link

keevan commented Jul 13, 2021

Outlined here also: https://h5p.org/node/1194058

I have an issue where adding this to a course index page as an embedded element (iframe) causes it to automatically scroll to the content on page load, regardless of where it is on the page. This issue could not be replicated locally consistently, but is caused in this block.

$card.one('transitionend', () => {
$card.focus()
});

What I'm not sure about is why this focus is required at all? The only time I believe this should be done is when the user clicks on a card, and the dialog card should scroll to the start of the top of the displayed card again (e.g. if it was too vertically high). What it currently does is trigger this code when loaded from an iframe (from what I've noticed), and the main window automatically scrolls to this content.

This is very similar to this linked issue https://h5p.org/node/1150636.

Platform: Moodle
Tested On Desktop
Happens in Firefox, Chrome, Chromium

H5P plugin version
1.21.0
H5P content type & version "version": "1.7.3"

"name": "h5p-dialogcards"
No console errors
No PHP errors
No env changes
No browser extensions/changes

I'll create and link a PR that fixes the issue I'm experiencing by removing the requirement to focus the card altogether. I might not be too aware of why it was added originally, but I believe unless it is functionally required (e.g. for screen-readers), I do not believe it should trigger a focus() event. If it should trigger a focus event, it should definitely only do so after some user interaction (e.g. changing cards), not on initial load.

keevan added a commit to keevan/h5p-dialogcards that referenced this issue Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant