mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-10 21:46:46 +08:00
Delay appearing input focus (#1001)
This commit is contained in:
parent
353e1f7889
commit
5cb0c68c41
1 changed files with 6 additions and 1 deletions
|
@ -96,7 +96,12 @@ window.liveSocket = liveSocket;
|
||||||
// Handling custom events dispatched with JS.dispatch/3
|
// Handling custom events dispatched with JS.dispatch/3
|
||||||
|
|
||||||
window.addEventListener("lb:focus", (event) => {
|
window.addEventListener("lb:focus", (event) => {
|
||||||
event.target.focus();
|
// The element may be about to show up via JS.show, which wraps the
|
||||||
|
// change in requestAnimationFrame, so we do the same to make sure
|
||||||
|
// the focus is applied only after we change the element visibility
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
event.target.focus();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("lb:set_value", (event) => {
|
window.addEventListener("lb:set_value", (event) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue