Skip to content

Commit

Permalink
chore(release): 8.2.22
Browse files Browse the repository at this point in the history
  • Loading branch information
smalluban committed Apr 23, 2024
1 parent e35a860 commit 762fb51
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [8.2.22](https://github.com/hybridsjs/hybrids/compare/v8.2.21...v8.2.22) (2024-04-23)

### [8.2.21](https://github.com/hybridsjs/hybrids/compare/v8.2.20...v8.2.21) (2024-04-19)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hybrids",
"version": "8.2.21",
"version": "8.2.22",
"description": "A JavaScript framework for creating fully-featured web applications, components libraries, and single web components with unique declarative and functional architecture",
"type": "module",
"exports": {
Expand Down
14 changes: 10 additions & 4 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ function setDebug(value = true) {

const scrollMap = new WeakMap();
const focusMap = new WeakMap();
function saveLayout(target) {
function saveLayout() {
const target = stacks.get(rootRouter)[0];
if (!target) return;

const focusEl = globalThis.document.activeElement;

focusMap.set(target, rootRouter.contains(focusEl) && focusEl);

const map = new Map();
Expand Down Expand Up @@ -285,7 +289,9 @@ function setupView(hybrids, routerOptions, parent, nestedParent) {
const root = rootRouter;

const goBackOnEscKey = (event) => {
if (event.key === "Escape") {
const stack = stacks.get(root);

if (stack[0] === host && event.key === "Escape") {
event.stopPropagation();
globalThis.history.go(-1);
}
Expand Down Expand Up @@ -957,6 +963,7 @@ function connectRootRouter(host, invalidate, options) {

globalThis.history.go(-offset);
} else {
saveLayout();
replace();
}
}
Expand All @@ -976,8 +983,7 @@ function connectRootRouter(host, invalidate, options) {
if (offset > -1) {
navigateBack(offset, entry, url);
} else {
let stack = stacks.get(host);
saveLayout(stack[0]);
saveLayout();

globalThis.history.scrollRestoration = "manual";
globalThis.history.pushState([entry, ...state], "", url);
Expand Down

0 comments on commit 762fb51

Please sign in to comment.