public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Timo Meschkat <timo.meschkat@datenzelt.de>
To: pve-devel@lists.proxmox.com
Subject: [RFC PATCH widget-toolkit 3/3] form: size field: add optional field description
Date: Mon, 26 Oct 2026 23:04:19 +0100	[thread overview]
Message-ID: <20261026220423.127776-4-timo.meschkat@datenzelt.de> (raw)
In-Reply-To: <20261026220423.127776-1-timo.meschkat@datenzelt.de>

The label alone, e.g. 'Memory', does not always tell what the value is
for. Allow describing it, e.g. as the memory of a VM. The description
is shown as tooltip together with the suffix hint and read by screen
readers.

Signed-off-by: Timo Meschkat <timo.meschkat@datenzelt.de>
---
 src/form/SizeUnitField.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/form/SizeUnitField.js b/src/form/SizeUnitField.js
index 9fd7308..4e9aef9 100644
--- a/src/form/SizeUnitField.js
+++ b/src/form/SizeUnitField.js
@@ -28,6 +28,9 @@ Ext.define('Proxmox.form.SizeUnitField', {
 
     emptyText: '',
 
+    // shown as tooltip and read by screen readers
+    fieldDescription: undefined,
+
     decimalPrecision: 2,
 
     // otherwise round to whole backend units
@@ -43,9 +46,13 @@ Ext.define('Proxmox.form.SizeUnitField', {
 
         // e.g. '512M, 8G'
         let examples = me.units.slice(0, 2).map((unit, i) => `${i === 0 ? 512 : 8}${unit[0]}`);
-        let hint = Ext.htmlEncode(
-            Ext.String.format(gettext('Also accepts a unit suffix, e.g. {0}'), examples.join(', ')),
+        let hint = Ext.String.format(
+            gettext('Also accepts a unit suffix, e.g. {0}'),
+            examples.join(', '),
         );
+        let descriptions = [me.fieldDescription, hint].filter((text) => !!text);
+        let qtip = descriptions.map((text) => Ext.htmlEncode(text)).join('<br>');
+        let ariaDescription = Ext.htmlEncode(descriptions.join('. '));
 
         me.items = [
             {
@@ -56,7 +63,7 @@ Ext.define('Proxmox.form.SizeUnitField', {
                 flex: 1,
                 // the field label belongs to the container, not the inputs
                 ariaLabel: me.fieldLabel,
-                inputAttrTpl: `data-qtip="${hint}" aria-description="${hint}"`,
+                inputAttrTpl: `data-qtip="${qtip}" aria-description="${ariaDescription}"`,
                 fieldStyle: 'text-align: right',
                 allowBlank: me.allowBlank,
                 emptyText: me.emptyText,
-- 
2.47.3




  parent reply	other threads:[~2026-10-26 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 22:04 [RFC PATCH widget-toolkit/manager 0/7] ui: allow selecting the unit for memory and disk sizes Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH widget-toolkit 1/3] form: add size field with selectable unit Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH widget-toolkit 2/3] form: size field: accept a unit suffix like 8G Timo Meschkat
2026-10-26 22:04 ` Timo Meschkat [this message]
2026-10-26 22:04 ` [RFC PATCH manager 1/4] fix #3760: ui: qemu: allow selecting the memory unit Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH manager 2/4] ui: lxc: allow selecting the unit for memory and swap Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH manager 3/4] ui: disk storage selector: allow selecting the size unit Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH manager 4/4] ui: disk resize: " Timo Meschkat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261026220423.127776-4-timo.meschkat@datenzelt.de \
    --to=timo.meschkat@datenzelt.de \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal