Skip to content

Commit 9142139

Browse files
committed
UI fix, Tags field Interaction Fix
1 parent e27affc commit 9142139

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

meta_creator/templates/meta_creator/showdata.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,9 @@ <h1>Extra Hints!</h1>
304304
<div class="person-info collapsible-content collapse" id="multiCollapsemaintainer">
305305
<p>An "maintainer" in software authorship is someone who significantly maintainers to the creation and development of software, including roles like coding, project management, and documentation.</p>
306306
</div>
307+
<span class="highlight-tag"> ⚠️ Click on contributors,authors or maintainers to see the description<span class="acknowledge-tag">Got it!</span></span>
307308
</div>
309+
308310
{% endif %}
309311
<input type="hidden" id="{{ key }}TableHiddenInput" name="{{ key }}TableHiddenInput"
310312
value='{{ value }}'>
@@ -415,7 +417,7 @@ <h1>Extra Hints!</h1>
415417
{% if unique_tab %}
416418
{% for col, value in metadata_dict.items %}
417419
<td data-col="{{ col }}" data-coltype="element" class="text-center">
418-
<input type="checkbox" class="checkbox-element" data-role="{{ col }}" name="checkbox-{{ col }}">
420+
<!-- <input type="checkbox" class="checkbox-element" data-role="{{ col }}" name="checkbox-{{ col }}" disabled> -->
419421
</td>
420422
{% endfor %}
421423
{% endif %}

static/foundation/css/foundation.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,6 @@ form.data-form3 {
339339
margin: 5% 0% 0% 0%;
340340
}
341341

342-
#Relatedpersons .tab.active {
343-
display: grid;
344-
}
345-
346342
.tab-description {
347343
background: #f5f7fa;
348344
border-left: 4px solid #0078d4;

static/foundation/js/vendor/table-utils.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ export function setupTables() {
247247
const col = input ? input.getAttribute("data-col") : null;
248248
const dataType = table.getAttribute("data-at-type");
249249
const td = document.createElement("td");
250-
td.className = "text-center";
251-
console.log({ header, input, col, colType, dataType });
250+
td.classList.add("text-left");
251+
// td.className = "text-center";
252252
if (colType === "element") {
253253
// Find the checkbox in the add-row-controls row
254254
console.log("Looking for checkbox with data-role:", col);
@@ -262,25 +262,23 @@ export function setupTables() {
262262
checkbox.name = `checkbox-${col}`;
263263
console.log("Try to check for checkbox");
264264
console.log({ checkboxInput });
265+
265266
// Set checked state based on add-row-controls checkbox
266267
if (checkboxInput && checkboxInput.checked) {
267268
checkbox.checked = true;
268-
console.log("Copyied checked state");
269269
}
270270
td.setAttribute("data-col", col);
271271
td.setAttribute("data-coltype", "element");
272272
td.setAttribute("data-type", dataType);
273273
td.appendChild(checkbox);
274274
} else if (colType === "dropdown") {
275-
console.log("Got to dropdown");
276275
td.className = "table-tagging-cell";
277276
td.setAttribute("data-col", col);
278277
td.setAttribute("data-coltype", "dropdown");
279278
td.setAttribute("data-type", dataType);
280279

281280
// Show the selected value as plain text
282281
const value = input ? input.value : "";
283-
console.log("Selected value:", input.value);
284282
td.textContent = value;
285283
} else if (
286284
colType === "tagging" ||
@@ -345,7 +343,13 @@ export function setupTables() {
345343

346344
// Insert new row above add-row-controls
347345
addRowControls.parentNode.insertBefore(newRow, addRowControls);
348-
346+
// Check if this td contains a checkbox
347+
document.querySelectorAll("td").forEach((td) => {
348+
if (td.querySelector('input[type="checkbox"]')) {
349+
td.classList.remove("text-left"); // remove old alignment
350+
td.classList.add("text-center"); // add new alignment
351+
}
352+
});
349353
initializeTableTaggingCells();
350354
enableEditableTagsInTable();
351355

static/foundation/js/vendor/tagging.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,14 @@ export function setupTagging({
175175
e.preventDefault();
176176
items[activeSuggestionIndex].click();
177177
enterHandledBySuggestion = true;
178+
setTimeout(() => input.focus(), 200);
178179
return;
179180
}
180181

181-
if (e.key === "Escape") {
182+
if (e.key === "Escape" || e.key === "Tab") {
182183
suggestionsBox.style.display = "none";
183184
activeSuggestionIndex = -1;
185+
input.blur();
184186
}
185187
});
186188

@@ -230,7 +232,7 @@ export function setupTagging({
230232
div.onclick = () => addTag(tag);
231233
suggestionsBox.appendChild(div);
232234
div.addEventListener("mouseenter", () => {
233-
activeSuggestionIndex = -1; // reset keyboard tracking
235+
// activeSuggestionIndex = -1; // reset keyboard tracking
234236
const allItems = suggestionsBox.querySelectorAll(".suggestion-item");
235237
allItems.forEach((item) => item.classList.remove("active"));
236238
div.classList.add("active");
@@ -298,6 +300,7 @@ export function setupTagging({
298300
if (e.key === "Enter") {
299301
if (enterHandledBySuggestion) {
300302
enterHandledBySuggestion = false;
303+
301304
return;
302305
}
303306

@@ -322,6 +325,7 @@ export function setupTagging({
322325
e.preventDefault();
323326
addTag(newTag);
324327
}
328+
setTimeout(() => input.focus(), 0);
325329
}
326330
});
327331
input.addEventListener("blur", () => {

0 commit comments

Comments
 (0)