Skip to content

Commit 5200ace

Browse files
SteffenDEgithub-actions[bot]
authored andcommitted
Update assets
1 parent 0abd80b commit 5200ace

File tree

6 files changed

+89
-92
lines changed

6 files changed

+89
-92
lines changed

priv/static/phoenix_live_view.cjs.js

Lines changed: 27 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

priv/static/phoenix_live_view.cjs.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

priv/static/phoenix_live_view.esm.js

Lines changed: 27 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

priv/static/phoenix_live_view.esm.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

priv/static/phoenix_live_view.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,11 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
11951195
aria_default.focusFirst(this.el);
11961196
}
11971197
});
1198-
this.el.addEventListener("phx:show-end", () => this.el.focus());
1199-
if (window.getComputedStyle(this.el).display !== "none") {
1200-
aria_default.focusFirst(this.el);
1198+
if (!this.el.contains(document.activeElement)) {
1199+
this.el.addEventListener("phx:show-end", () => this.el.focus());
1200+
if (window.getComputedStyle(this.el).display !== "none") {
1201+
aria_default.focusFirst(this.el);
1202+
}
12011203
}
12021204
}
12031205
}
@@ -2372,7 +2374,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
23722374
transitionPendingRemoves() {
23732375
let { pendingRemoves, liveSocket } = this;
23742376
if (pendingRemoves.length > 0) {
2375-
liveSocket.transitionRemoves(pendingRemoves, false, () => {
2377+
liveSocket.transitionRemoves(pendingRemoves, () => {
23762378
pendingRemoves.forEach((el) => {
23772379
let child = dom_default.firstPhxChild(el);
23782380
if (child) {
@@ -2832,10 +2834,10 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
28322834
view.liveSocket.pushHistoryPatch(e, href, replace ? "replace" : "push", sourceEl);
28332835
},
28342836
exec_focus(e, eventType, phxEvent, view, sourceEl, el) {
2835-
window.requestAnimationFrame(() => aria_default.attemptFocus(el));
2837+
aria_default.attemptFocus(el);
28362838
},
28372839
exec_focus_first(e, eventType, phxEvent, view, sourceEl, el) {
2838-
window.requestAnimationFrame(() => aria_default.focusFirstInteractive(el) || aria_default.focusFirst(el));
2840+
aria_default.focusFirstInteractive(el) || aria_default.focusFirst(el);
28392841
},
28402842
exec_push_focus(e, eventType, phxEvent, view, sourceEl, el) {
28412843
window.requestAnimationFrame(() => focusStack.push(el || sourceEl));
@@ -2941,18 +2943,14 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
29412943
}
29422944
} else {
29432945
if (this.isVisible(el)) {
2944-
window.requestAnimationFrame(() => {
2945-
el.dispatchEvent(new Event("phx:hide-start"));
2946-
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = "none");
2947-
el.dispatchEvent(new Event("phx:hide-end"));
2948-
});
2946+
el.dispatchEvent(new Event("phx:hide-start"));
2947+
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = "none");
2948+
el.dispatchEvent(new Event("phx:hide-end"));
29492949
} else {
2950-
window.requestAnimationFrame(() => {
2951-
el.dispatchEvent(new Event("phx:show-start"));
2952-
let stickyDisplay = display || this.defaultDisplay(el);
2953-
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = stickyDisplay);
2954-
el.dispatchEvent(new Event("phx:show-end"));
2955-
});
2950+
el.dispatchEvent(new Event("phx:show-start"));
2951+
let stickyDisplay = display || this.defaultDisplay(el);
2952+
dom_default.putSticky(el, "toggle", (currentEl) => currentEl.style.display = stickyDisplay);
2953+
el.dispatchEvent(new Event("phx:show-end"));
29562954
}
29572955
}
29582956
},
@@ -5014,20 +5012,21 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
50145012
browser_default.redirect(to, flash);
50155013
}
50165014
replaceMain(href, flash, callback = null, linkRef = this.setPendingLink(href)) {
5017-
let liveReferer = this.currentLocation.href;
5015+
const liveReferer = this.currentLocation.href;
50185016
this.outgoingMainEl = this.outgoingMainEl || this.main.el;
5019-
let removeEls = dom_default.all(this.outgoingMainEl, `[${this.binding("remove")}]`);
5020-
let newMainEl = dom_default.cloneNode(this.outgoingMainEl, "");
5017+
const stickies = dom_default.findPhxSticky(document) || [];
5018+
const removeEls = dom_default.all(this.outgoingMainEl, `[${this.binding("remove")}]`).filter((el) => !dom_default.isChildOfAny(el, stickies));
5019+
const newMainEl = dom_default.cloneNode(this.outgoingMainEl, "");
50215020
this.main.showLoader(this.loaderTimeout);
50225021
this.main.destroy();
50235022
this.main = this.newRootView(newMainEl, flash, liveReferer);
50245023
this.main.setRedirect(href);
5025-
this.transitionRemoves(removeEls, true);
5024+
this.transitionRemoves(removeEls);
50265025
this.main.join((joinCount, onDone) => {
50275026
if (joinCount === 1 && this.commitPendingLink(linkRef)) {
50285027
this.requestDOMUpdate(() => {
50295028
removeEls.forEach((el) => el.remove());
5030-
dom_default.findPhxSticky(document).forEach((el) => newMainEl.appendChild(el));
5029+
stickies.forEach((el) => newMainEl.appendChild(el));
50315030
this.outgoingMainEl.replaceWith(newMainEl);
50325031
this.outgoingMainEl = null;
50335032
callback && callback(linkRef);
@@ -5036,12 +5035,8 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
50365035
}
50375036
});
50385037
}
5039-
transitionRemoves(elements, skipSticky, callback) {
5038+
transitionRemoves(elements, callback) {
50405039
let removeAttr = this.binding("remove");
5041-
if (skipSticky) {
5042-
const stickies = dom_default.findPhxSticky(document) || [];
5043-
elements = elements.filter((el) => !dom_default.isChildOfAny(el, stickies));
5044-
}
50455040
let silenceEvents = (e) => {
50465041
e.preventDefault();
50475042
e.stopImmediatePropagation();
@@ -5401,7 +5396,8 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
54015396
this.registerNewLocation(window.location);
54025397
}
54035398
historyRedirect(e, href, linkState, flash, targetEl) {
5404-
if (targetEl && e.isTrusted && e.type !== "popstate") {
5399+
const clickLoading = targetEl && e.isTrusted && e.type !== "popstate";
5400+
if (clickLoading) {
54055401
targetEl.classList.add("phx-click-loading");
54065402
}
54075403
if (!this.isConnected() || !this.main.isMain()) {
@@ -5427,6 +5423,9 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
54275423
dom_default.dispatchEvent(window, "phx:navigate", { detail: { href, patch: false, pop: false, direction: "forward" } });
54285424
this.registerNewLocation(window.location);
54295425
}
5426+
if (clickLoading) {
5427+
targetEl.classList.remove("phx-click-loading");
5428+
}
54305429
done();
54315430
});
54325431
});

0 commit comments

Comments
 (0)