68cf65f02c26
edit descriptions through direct click and keyboard activation (v3.0.125)
- time
- 2026-09-29 21:25 UTC · 1 week ago
- machine
- Junes-MacBook-Pro.local
- agent
- gpt-6-sol
- session
- description click editing
- parent
- dc1ad7f95d01
↓ kepr-68cf65f0.tar.gzatlas at this save
files changed3 files
package.json+1 −1public/css/kepr.css+3 −0public/js/kepr.js+32 −1package.json+1 −1
@@ -1,6 +1,6 @@11 {22 "name": "kepr",3- "version": "3.0.124",3+ "version": "3.0.125",44 "private": true,55 "type": "module",66 "scripts": {public/css/kepr.css+3 −0
@@ -2364,6 +2364,9 @@23642364 cursor: pointer;23652365 vertical-align: middle;23662366 }2367+.repo-desc-editable:not(:has(.editor)) {2368+ cursor: text;2369+}23672370 .edit-btn:hover {23682371 color: var(--accent);23692372 border-color: var(--accent-dim);public/js/kepr.js+32 −1
@@ -669,6 +669,24 @@669669 ];670670 for (const [field, section, body] of places) {671671 section.hidden = false;672+ if (field === "description") {673+ section.tabIndex = 0;674+ section.setAttribute("role", "button");675+ section.setAttribute("aria-label", "edit repository description");676+ section.classList.add("repo-desc-editable");677+ if (!section.textContent.trim()) section.textContent = "add a description";678+ const activate = (event) => {679+ if (event.target.closest(".editor") || body.querySelector(".editor")) return;680+ event.preventDefault();681+ editText(base, texts.form, field, body, texts[field]);682+ };683+ section.addEventListener("click", activate);684+ section.addEventListener("keydown", (event) => {685+ if (event.target === section && (event.key === "Enter" || event.key === " "))686+ activate(event);687+ });688+ continue;689+ }672690 const button = element("button", "edit-btn mono", "edit");673691 button.type = "button";674692 (section.querySelector(".repo-details-head") ?? section).append(button);@@ -684,6 +702,11 @@684702 685703 function editText(base, form, field, body, text) {686704 const kept = [...body.childNodes];705+ if (field === "description") {706+ body.removeAttribute("role");707+ body.removeAttribute("tabindex");708+ body.removeAttribute("aria-label");709+ }687710 const input = element("textarea", "editor-input mono");688711 input.value = text;689712 input.rows = field === "details" ? 16 : 3;@@ -794,7 +817,15 @@794817 if (answer?.ok) location.reload();795818 else status.textContent = answer ? await answer.text() : "not saved: offline?";796819 };797- const cancel = () => body.replaceChildren(...kept);820+ const cancel = () => {821+ body.replaceChildren(...kept);822+ if (field === "description") {823+ body.tabIndex = 0;824+ body.setAttribute("role", "button");825+ body.setAttribute("aria-label", "edit repository description");826+ body.focus();827+ }828+ };798829 const tool = (label, title, action) => {799830 const b = element("button", "fv-ctrl-btn", label);800831 b.type = "button";