honkit / honkit

:book: HonKit is building beautiful books using Markdown - Fork of GitBook

Home Page:https://honkit.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

azu opened this issue · comments

commented

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)

commented

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.