diff --git a/resources/views/business/pages/systemization-todos.blade.php b/resources/views/business/pages/systemization-todos.blade.php index fd162ea2..3ce5a15b 100644 --- a/resources/views/business/pages/systemization-todos.blade.php +++ b/resources/views/business/pages/systemization-todos.blade.php @@ -77,7 +77,7 @@ .sys-todo-grid-value.is-dirty { background:#fff8e8; } .sys-todo-grid-editor { display:block; box-sizing:border-box; width:100%; min-height:1.9rem; padding:.3rem .4rem; border:0; border-radius:.28rem; background:#fff; color:#171717; font:inherit; font-size:.78rem; line-height:1.5; outline:none; resize:vertical; } textarea.sys-todo-grid-editor { min-height:4rem; } - .sys-todo-grid-date-editor { position:fixed; top:0; left:0; z-index:45; display:grid; box-sizing:border-box; width:min(18rem,calc(100vw - 1rem)); padding:.55rem; border:1px solid var(--sys-border); border-radius:.55rem; background:#fff; box-shadow:0 6px 18px rgba(23,23,23,.16); gap:.45rem; } + .sys-todo-grid-date-editor { position:fixed; top:0; left:0; z-index:45; display:grid; box-sizing:border-box; width:min(18rem,calc(100vw - 1rem)); max-height:calc(100vh - 1rem); padding:.55rem; border:1px solid var(--sys-border); border-radius:.55rem; background:#fff; box-shadow:0 6px 18px rgba(23,23,23,.16); gap:.45rem; overflow-y:auto; overscroll-behavior:contain; } .sys-todo-grid-date-editor .upstream-data-date { width:100%; } .sys-todo-grid-date-editor .upstream-data-date input { height:2rem; font-size:.75rem; } .sys-todo-grid-date-editor .upstream-data-date__pick { height:2rem; } @@ -2759,9 +2759,19 @@ viewportWidth - width - 8 )); var below = anchor.bottom + 4; - var above = anchor.top - height - 4; - var top = below + height <= viewportHeight - 8 ? below : above; - top = Math.max(8, Math.min(top, viewportHeight - height - 8)); + var top = below; + if (below + height > viewportHeight - 8) { + var sideTop = Math.max(8, Math.min(anchor.top, viewportHeight - height - 8)); + if (anchor.left - width - 8 >= 8) { + left = anchor.left - width - 8; + top = sideTop; + } else if (anchor.right + width + 8 <= viewportWidth - 8) { + left = anchor.right + 8; + top = sideTop; + } else { + top = sideTop; + } + } wrapper.style.left = Math.round(left) + 'px'; wrapper.style.top = Math.round(top) + 'px'; }