@yuneta/gobj-ui 7.23.127 → 7.23.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7393,9 +7393,15 @@ function name_form_control($field, conf) {
7393
7393
  let key = conf.label_i18n || conf.label || "";
7394
7394
  if (!key) return;
7395
7395
  let $control = $field.querySelector("input, select, textarea");
7396
- if (!$control || $control.getAttribute("aria-label")) return;
7397
- $control.setAttribute("aria-label", (0, i18next.t)(key));
7398
- $control.setAttribute("data-i18n-aria-label", key);
7396
+ if ($control && !$control.getAttribute("aria-label")) {
7397
+ $control.setAttribute("aria-label", (0, i18next.t)(key));
7398
+ $control.setAttribute("data-i18n-aria-label", key);
7399
+ }
7400
+ let $ts = $field.querySelector(".ts-control input");
7401
+ if ($ts && !$ts.getAttribute("aria-label")) {
7402
+ $ts.setAttribute("aria-label", (0, i18next.t)(key));
7403
+ $ts.setAttribute("data-i18n-aria-label", key);
7404
+ }
7399
7405
  }
7400
7406
  function build_form(gobj) {
7401
7407
  let form_id = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "form_id");
@@ -25087,12 +25093,15 @@ function create_tabulator(gobj) {
25087
25093
  if (cellClick) colDef.cellClick = cellClick;
25088
25094
  columns.push(colDef);
25089
25095
  }
25096
+ function attr_text(value) {
25097
+ return String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
25098
+ }
25090
25099
  function operateFormatter(cell, formatterParams, onRendered) {
25091
25100
  return [
25092
- "<button class=\"button without-border px-2 edit\">",
25101
+ `<button class="button without-border px-2 edit" title="${attr_text((0, i18next.t)("edit"))}" aria-label="${attr_text((0, i18next.t)("edit"))}">`,
25093
25102
  "<i style=\"\" class=\"yi-pen has-text-link\"></i>",
25094
25103
  "</button>",
25095
- "<button class=\"button without-border px-2 remove\">",
25104
+ `<button class="button without-border px-2 remove" title="${attr_text((0, i18next.t)("delete"))}" aria-label="${attr_text((0, i18next.t)("delete"))}">`,
25096
25105
  "<i style=\"\" class=\"yi-trash has-text-danger\"></i>",
25097
25106
  "</button>"
25098
25107
  ].join("");
@@ -7388,9 +7388,15 @@ function name_form_control($field, conf) {
7388
7388
  let key = conf.label_i18n || conf.label || "";
7389
7389
  if (!key) return;
7390
7390
  let $control = $field.querySelector("input, select, textarea");
7391
- if (!$control || $control.getAttribute("aria-label")) return;
7392
- $control.setAttribute("aria-label", t(key));
7393
- $control.setAttribute("data-i18n-aria-label", key);
7391
+ if ($control && !$control.getAttribute("aria-label")) {
7392
+ $control.setAttribute("aria-label", t(key));
7393
+ $control.setAttribute("data-i18n-aria-label", key);
7394
+ }
7395
+ let $ts = $field.querySelector(".ts-control input");
7396
+ if ($ts && !$ts.getAttribute("aria-label")) {
7397
+ $ts.setAttribute("aria-label", t(key));
7398
+ $ts.setAttribute("data-i18n-aria-label", key);
7399
+ }
7394
7400
  }
7395
7401
  function build_form(gobj) {
7396
7402
  let form_id = gobj_read_str_attr(gobj, "form_id");
@@ -25082,12 +25088,15 @@ function create_tabulator(gobj) {
25082
25088
  if (cellClick) colDef.cellClick = cellClick;
25083
25089
  columns.push(colDef);
25084
25090
  }
25091
+ function attr_text(value) {
25092
+ return String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
25093
+ }
25085
25094
  function operateFormatter(cell, formatterParams, onRendered) {
25086
25095
  return [
25087
- "<button class=\"button without-border px-2 edit\">",
25096
+ `<button class="button without-border px-2 edit" title="${attr_text(t("edit"))}" aria-label="${attr_text(t("edit"))}">`,
25088
25097
  "<i style=\"\" class=\"yi-pen has-text-link\"></i>",
25089
25098
  "</button>",
25090
- "<button class=\"button without-border px-2 remove\">",
25099
+ `<button class="button without-border px-2 remove" title="${attr_text(t("delete"))}" aria-label="${attr_text(t("delete"))}">`,
25091
25100
  "<i style=\"\" class=\"yi-trash has-text-danger\"></i>",
25092
25101
  "</button>"
25093
25102
  ].join("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.127",
3
+ "version": "7.23.128",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
package/src/c_yui_form.js CHANGED
@@ -517,11 +517,22 @@ function name_form_control($field, conf)
517
517
  return; /* a field with no label names nothing */
518
518
  }
519
519
  let $control = $field.querySelector("input, select, textarea");
520
- if(!$control || $control.getAttribute("aria-label")) {
521
- return;
520
+ if($control && !$control.getAttribute("aria-label")) {
521
+ $control.setAttribute("aria-label", t(key));
522
+ $control.setAttribute("data-i18n-aria-label", key);
523
+ }
524
+
525
+ /* Tom Select HIDES the <select> it is given (`ts-hidden-accessible`)
526
+ * and draws its own text box in front of it. Naming the original
527
+ * therefore names the element nobody can reach: the box the reader
528
+ * actually lands on had no name at all. Give it the same one -- it
529
+ * is the same field -- and only when it has none, so a field that
530
+ * named its own box keeps it. */
531
+ let $ts = $field.querySelector(".ts-control input");
532
+ if($ts && !$ts.getAttribute("aria-label")) {
533
+ $ts.setAttribute("aria-label", t(key));
534
+ $ts.setAttribute("data-i18n-aria-label", key);
522
535
  }
523
- $control.setAttribute("aria-label", t(key));
524
- $control.setAttribute("data-i18n-aria-label", key);
525
536
  }
526
537
 
527
538
  function build_form(gobj)
@@ -1371,12 +1371,28 @@ function create_tabulator(gobj)
1371
1371
  /*
1372
1372
  * Column with operators: edit, delete
1373
1373
  */
1374
+ /* Two ICON-ONLY buttons with no name of any kind -- and written as an
1375
+ * HTML STRING, where no sweep of `createElement2` specs can see them.
1376
+ * `t()` alone is enough and no `data-i18n-aria-label` is needed: a
1377
+ * language change re-runs `setColumns()`, which re-runs this
1378
+ * formatter. The text goes through an escaper because a translation
1379
+ * is text entering an attribute. */
1380
+ function attr_text(value) {
1381
+ return String(value)
1382
+ .replace(/&/g, "&amp;").replace(/"/g, "&quot;")
1383
+ .replace(/</g, "&lt;").replace(/>/g, "&gt;");
1384
+ }
1385
+
1374
1386
  function operateFormatter(cell, formatterParams, onRendered) {
1375
1387
  return [
1376
- '<button class="button without-border px-2 edit">',
1388
+ `<button class="button without-border px-2 edit" ` +
1389
+ `title="${attr_text(t("edit"))}" ` +
1390
+ `aria-label="${attr_text(t("edit"))}">`,
1377
1391
  '<i style="" class="yi-pen has-text-link"></i>',
1378
1392
  '</button>',
1379
- '<button class="button without-border px-2 remove">',
1393
+ `<button class="button without-border px-2 remove" ` +
1394
+ `title="${attr_text(t("delete"))}" ` +
1395
+ `aria-label="${attr_text(t("delete"))}">`,
1380
1396
  '<i style="" class="yi-trash has-text-danger"></i>',
1381
1397
  '</button>'
1382
1398
  ].join('');