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

theme-default: Deprivation of focus when loading the page. #367

Open
azu opened this issue Jul 19, 2023 · 1 comment
Open

theme-default: Deprivation of focus when loading the page. #367

azu opened this issue Jul 19, 2023 · 1 comment
Labels
Type: Bug Bug or Bug fixes Type: Theme Theme related

Comments

@azu
Copy link
Member

azu commented Jul 19, 2023

I notice that creating https://stackblitz.com/edit/honkit-template?file=README.md

It is a bit cumbersome to lose focus on the editor when changing documents.

Probably, following step got the focus.

if ($pageWrapper && $pageWrapper[0]) {
// use Native focus
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus
$pageWrapper[0].focus({ preventScroll: true });
}

Originally posted by @azu in #366 (comment)

@azu azu added the Type: Theme Theme related label Jul 19, 2023
@azu
Copy link
Member Author

azu commented Jul 19, 2023

I do know why .focus().

If https://stackblitz.com/edit/honkit-template?file=README.md (the case of iframes), we can probably get around this by using https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement.

@azu azu added the Type: Bug Bug or Bug fixes label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes Type: Theme Theme related
Projects
None yet
Development

No branches or pull requests

1 participant