التخطّي إلى المحتوى
menumenu tanreiexpand_morecontrasttranslate
tanreiexpand_more
البدءWebReactSwiftUIJetpack ComposeFlutterReact Nativeالإعدادات الجاهزةنظام التصميم الخاص بكاستخدام Tanrei مع وكلاء الذكاء الاصطناعيالعلامة التجاريةرموز التصميمأنظمة التصميم والتخصيصTheme Studioاللونالطباعةالأيقوناتالشكلالارتفاعالحركةحالات التفاعلالسلوكالتخطيطإمكانية الوصولالكلماترموز الألوانرموز السلّم الطباعيرموز الشكلرموز الارتفاعرموز الحركةرموز الحالةرموز التباعد والقياسالمكوّناتالزرزر الإجراء الرئيسيالزر المقسَّممجموعة الأزرارزر مع قائمةشريط الأدواتزر النسخخانة الاختيارزر الاختيارمفتاح التبديلالرقاقةقائمة الخياراتشريط التمريرحقل شريط التمريرالتقويمDateTimePickerمجموعة الحقولمجموعة أزرار الاختيارمجموعة خانات الاختيارعنصر الاختيارحقل الاختيارشريط القوائمرفع الملفاتمنتقي الملفات متقدّمساحة الإفلاتحقل إدخال النص متقدّمحقل النصحقل الرقاقاتالحقلمربع التحرير والسرد متقدّمحقل التحرير والسردحقل إدخال العدد متقدّمحقل العددحقل إدخال اللون متقدّمحقل اللونحقل إدخال الرمز لمرة واحدة متقدّمحقل الرمز لمرة واحدةحقل إدخال النص المدمج متقدّممربع كتابة الرسائلالبطاقةالفاصلالطبقة النمطية متقدّممربع الحوارالقائمة (list)صف القائمةاللوحة السفليةاللوحة الجانبيةالعرض الدوّاركتلة الشيفرةالجدولاللوحة المنبثقةالخطواتالأكورديونقائمة الوصفالشكل التوضيحيهيكل التطبيقرأس الصفحةالعرض الشجريالخط الزمنيمعاينة الصورمقبض تغيير الحجمالإطار القابل لتغيير الحجممنطقة التمريرالشارةمؤشر التقدمالعدّادعارض الأرقام المتحرّكمؤشر التحميلشريط الإشعار (Snackbar)التلميحاختصار لوحة المفاتيحالوسمالشيفرة المضمَّنةالتنويهالصورة الرمزيةالحالة الفارغةمجموعة الوسومهيكل التحميلعنصر الملفمربع اللونالنص المتحركعلامات التبويبعرض التبويباتشريط التطبيقشريط التنقلدرج التنقلالبحثالرابطالتنقل بين الصفحاتروابط السابق والتاليمؤشر الخطواتمسار التنقلجدول المحتوياتبطاقة الرابطقائمة FABالحالةكيف يُبنى Tanreiالمساهمةالترخيص والإسناد
الرئيسيةالمكوّناتمجموعة خانات الاختيار

مجموعة خانات الاختيار

تطرح سؤالًا واحدًا قد تكون له عدة أجوبة من بين خيارات قليلة معروضة كلها دفعة واحدة، وهي مجموعة من خانات الاختيار تحت تسمية واحدة، مع وصف وخطأ واحد، تحمل قائمة القيم المحدَّدة تحت اسم واحد وتستطيع أن تأتي بخانة اختيار تحدّدها كلها.

content_copyعرض بتنسيق Markdown
الفئة
الاختيار
الرموز
comp.field-group
المستوى
مركّب
مبني من
Field group, Checkbox

نظرة عامة

Web
tanrei-checkbox-group
schedule
SwiftUI
TanreiCheckboxGroup
radio_button_unchecked
Jetpack Compose
TanreiCheckboxGroup
radio_button_unchecked
Flutter
TanreiCheckboxGroup
radio_button_unchecked
React Native
CheckboxGroup
radio_button_unchecked

مولَّد من docs/status/status.json, specs/checkbox-group.spec.json

مجموعة خانات اختيار، وأخرى فيها خانة اختيار تحدّدها كلها

استخدم مجموعة خانات الاختيار (checkbox group) حيث يكون جواب السؤال الواحد قائمة، والخيارات قليلة بحيث تُعرض كلها دفعة واحدة، حتى سبعة تقريبًا: طرق الإبلاغ، أو الأيام التي يُرسل فيها تقرير، أو الأصناف التي تُصفّى بها قائمة. والجواب قيمة واحدة، هي قائمة القيم المحدَّدة، والنموذج يرسلها تحت اسم واحد.

تُبنى من مجموعة حقول وخانات اختيار. مجموعة الحقول هي الإطار: التسمية، وعلامة المطلوب أو الاختياري، والوصف، والخطأ، والتخطيط في عمود أو صف. وخانات الاختيار تحمل القيمة: كل خانة منها خيار له تسميته، والمحدَّد منها هو القائمة. ومجموعة خانات الاختيار لا ترسم شيئًا من عندها وليس لها أي رمز تصميم (token). وما تضيفه إلى الاثنين هو الحالة التي يكتبها كل منتج لولاها: القائمة وحدث change واحد لها، واسم واحد في النموذج مع إعادة الضبط وتحقق النموذج نفسه من أن المجموعة المطلوبة ليست فارغة، والحالات الثلاث لخانة تحديد الكل.

وعرضها عرض المكان الذي توضع فيه.

على الويب هي <tanrei-checkbox-group>. والمنصات الأخرى لم تنفّذها بعد.

الاستخدام

كل خانة اختيار هي الخيار الذي تسمّيه قيمتها value. والخاصية value في المجموعة هي قائمة القيم المحدَّدة، بترتيب خانات الاختيار. والقيمة التي في القائمة وليست لأي خانة اختيار تُحفظ: فالخيارات التي أخرجها بحث من مجال الرؤية تبقى مختارة.

<form>
  <tanrei-checkbox-group name="notify" label="أبلِغني عبر"
    supporting-text="اختر كل ما ينطبق."
    required required-text="مطلوب"
    error-text="اختر طريقة واحدة على الأقل للتواصل معك.">
    <tanrei-checkbox value="email" label="البريد الإلكتروني" checked></tanrei-checkbox>
    <tanrei-checkbox value="text" label="رسالة نصية"></tanrei-checkbox>
    <tanrei-checkbox value="push" label="إشعار فوري"></tanrei-checkbox>
  </tanrei-checkbox-group>
</form>

<script type="module">
  import '@tanrei/web/components/checkbox-group';

  const group = document.querySelector('tanrei-checkbox-group');
  group.addEventListener('change', (event) => {
    // event.detail.value هي القائمة الجديدة؛ و group.value تحملها سلفًا.
    group.error = event.detail.value.length === 0;
  });
  // المنتج يعيّن الجواب قائمةً. وهي خاصية للعنصر: ليست هناك خاصية HTML باسم value.
  group.value = ['email', 'push'];
</script>
import { Checkbox, CheckboxGroup } from '@tanrei/react';

const [channels, setChannels] = useState(['email']);

<CheckboxGroup name="notify" label="أبلِغني عبر" supportingText="اختر كل ما ينطبق."
               value={channels} onChange={(event) => setChannels(event.detail.value)}
               error={channels.length === 0} errorText="اختر طريقة واحدة على الأقل للتواصل معك.">
  <Checkbox value="email" label="البريد الإلكتروني" />
  <Checkbox value="text" label="رسالة نصية" />
  <Checkbox value="push" label="إشعار فوري" />
</CheckboxGroup>

في الترميز تُكتب القيمة الأولى حيث يكتبها HTML: بالخاصية checked على خانات الاختيار. ومتى عيّن المنتج value، صارت value هي التي تقرّر أيّ خانات الاختيار محدَّدة.

خانة اختيار تحدّدها كلها

أعطِ selectAllLabel فتأتي المجموعة بخانة اختيار إضافية قبل الأولى، يسمّيها ذلك النص. وهي محدَّدة ما دامت كل خانة اختيار يستطيع الشخص تبديلها محدَّدة، وغير محسومة ما دام بعضها محدَّدًا، وغير محدَّدة ما دامت كلها غير محدَّدة. والضغط عليها وهي غير محدَّدة أو غير محسومة يحدّدها كلها؛ والضغط عليها وهي محدَّدة يلغي تحديدها كلها. وليست مُدخلة في القائمة ولا ترسل شيئًا.

<tanrei-checkbox-group name="days" label="إرسال التقرير يوم" select-all-label="كل أيام العمل">
  <tanrei-checkbox value="mon" label="الاثنين"></tanrei-checkbox>
  <tanrei-checkbox value="tue" label="الثلاثاء"></tanrei-checkbox>
  …
</tanrei-checkbox-group>

خانة الاختيار التي عطّلتها أنت بنفسك تُترك كما هي، محدَّدة أو غير محدَّدة، ولا تُحسب: فخانة تحديد الكل لا تحسب إلا الخيارات التي يستطيع الشخص تبديلها. واكتب التسمية لهذه المجموعة بعينها، مثل «كل هذه» أو «كل أيام العمل»، بكلمات السؤال؛ فهي لا تُقرأ أبدًا من كلمات المنتج.

مستوى واحد إلى الأسفل

المجموعة نفسها مكتوبةً باليد من عضويها هي الصورة نفسها، والمجموعة نفسها عند التقنيات المساعدة:

<tanrei-field-group label="أبلِغني عبر" supporting-text="اختر كل ما ينطبق."
                    required required-text="مطلوب">
  <tanrei-checkbox name="notify" value="email" label="البريد الإلكتروني" checked></tanrei-checkbox>
  <tanrei-checkbox name="notify" value="text" label="رسالة نصية"></tanrei-checkbox>
  <tanrei-checkbox name="notify" value="push" label="إشعار فوري"></tanrei-checkbox>
</tanrei-field-group>

المجموعة نفسها مكتوبةً باليد: مجموعة حقول بداخلها خانات اختيار

ما لا تفعله مجموعة الحقول وخانات الاختيار المكتوبة باليد هو حمل الجواب:

الجانب الكتابة باليد مجموعة خانات الاختيار
القائمة يقرؤها المنتج من كل خانة اختيار الخاصية value، وحدث change واحد
تعيين الجواب الخاصية checked على كل خانة اختيار value = […]
إعادة الضبط والاستعادة كل خانة اختيار بمفردها عنصر تحكم واحد
مجموعة مطلوبة تُركت فارغة المنتج يتحقق يرفضها تحقق النموذج نفسه
قيمة لا تُعرض خانة اختيارها تضيع تُحفظ
خانة اختيار تحدّدها كلها يكتبها المنتج، بالخاصية indeterminate الخاصية selectAllLabel
ما يرسله النموذج المُدخلات نفسها المُدخلات نفسها

انزل إلى هذا المستوى حين لا تكون المجموعة جوابًا واحدًا:

تحتاج إلى استخدم
عدة خيارات من بضعة، جوابًا واحدًا تحت اسم واحد مجموعة خانات الاختيار
خانات اختيار لكلٍّ منها اسم خاص بها في النموذج، أو مجموعة تحمل شيئًا ليس خانة اختيار مجموعة حقول بداخلها خانات اختيار
قاعدة من عندك لمعنى «الكل»، ككل عنصر في صفحة أو كل عنصر مطابق مجموعة حقول فيها خانة اختيار تعيّن عليها indeterminate بنفسك
واحد من بضعة مجموعة أزرار الاختيار
شيء واحد مفعَّل أو موقوف خانة اختيار، أو مفتاح تبديل حيث يسري فورًا
عدة خيارات من كثير، أو مكان ضيق عنصر اختيار أو قائمة بتحديد متعدد

المواصفات

صف، وجواب مرفوض، وخيار مفعَّل دائمًا، ومجموعة معطَّلة

ما يعطيه كل عضو

الجانب من مجموعة الحقول من خانات الاختيار ما للمجموعة نفسها
الخصائص label، labelHidden، supportingText، errorText، error، disabled، required، optional، requiredMark، requiredText، optionalText، orientation الخصائص value و label و disabled لكل خانة اختيار، على الخانة نفسها value، selectAllLabel
الأحداث — لا شيء: خانة الاختيار التي في مجموعة لا تصدر حدثًا من عندها change
رموز التصميم comp.field-group.* comp.checkbox.* لا شيء
  • المطلوب يعني واحدة على الأقل. والعدد الأدنى أو الأقصى («اختر حتى ثلاثة») قاعدتك أنت: اقرأ طول القائمة في الحدث change، وعيِّن error، واكتب errorText وفيه العدد بكلماتك.
  • الخطأ خطأ المجموعة. الخاصية error ترسم errorText تحت خانة الاختيار الأخيرة وتضع كل خانة اختيار في حالة الخطأ الخاصة بها. والمجموعة لا تعيّنها أبدًا، وتغيّر القيمة لا يزيلها. أما خانة اختيار واحدة في حالة الخطأ داخل مجموعة ليست في حالة الخطأ، فذلك error الخاصة بتلك الخانة نفسها.
  • التعطيل. المجموعة المعطَّلة تحتفظ بقيمتها ولا ترسل شيئًا. وخانة الاختيار المعطَّلة بمفردها في مجموعة غير معطَّلة تحتفظ بمُدخلتها في القائمة، وتُرسل هذه المُدخلة مع القائمة: فالخيار المفعَّل دائمًا خانة اختيار واحدة معطَّلة ومحدَّدة، بلا حقل مخفيّ بجانبها.
  • ليست هناك حالة للقراءة فقط، لأن خانة الاختيار ليست لها هذه الحالة.

ما يفعله الإطار، أي علامة المطلوب والوصف والخطأ وكيف يُعلَن والعمود والصف الذي يلتفّ، في صفحة مجموعة الحقول. وما تفعله خانة الاختيار في صفحة خانة الاختيار.

تخصيص مجموعة واحدة دون غيرها

ليس لمجموعة خانات الاختيار رمز تصميم خاص بها. إطارها يقرأ رموز تصميم مجموعة الحقول، وخانات الاختيار فيها تقرأ رموز تصميم خانة الاختيار، أينما عُيِّنت. ولتغيير مثيل واحد، عيِّن رمز تصميم العضو عليه:

<tanrei-checkbox-group label="أبلِغني عبر"
  style="--tanrei-comp-field-group-gap-controls: 12px">…</tanrei-checkbox-group>

البنية

الجزء الوصف
1 label The field group's label: names the set — the question — above the checkboxes. The requirement mark follows it.
2 requirement-label · اختياري The field group's requirement mark: a small tag that is not a control, saying an answer is required or optional; or, for required, an asterisk after the label.
3 supporting-text · اختياري The field group's description: a line under the label, before the checkboxes, that says how to answer. It stays while the group is in error.
4 select-all · اختياري One more checkbox before the first, brought by the group where selectAllLabel is given: the Checkbox component, checked, unchecked or indeterminate from the checkboxes of the set, and checking or unchecking them all. It is no entry of the value.
5 checkboxes The checkboxes of the set, in the order given, in a column or in a row that wraps. Each is the Checkbox component with its own label, drawn from its own tokens; which of them are checked is the group's value.
6 error-text · اختياري The field group's error text: the reason the answer was refused or is missing, below the last checkbox.

الخصائص

الخاصية النوع القيمة الافتراضية الوصف
value strings The values of the checked checkboxes: a list of strings, empty while none is checked (the platforms whose idiom it is take a set). The checkbox group sets it when a person switches a checkbox, and emits change; the product may also set it. It is the set's value: what a form submits under the group's one name.
label string "" Names the set, visibly and to assistive technology: the question its controls answer ("Notify me by"). Required. — Field group
labelHidden boolean false Does not draw the label, which stays the accessible name of the group. For a set whose visible heading is elsewhere. — Field group
supportingText string "" The description: how to answer ("Choose all that apply"), drawn under the label and given to assistive technology as the group's description. — Field group
errorText string "" What is wrong with the set as a whole and how to put it right ("Choose at least one"), drawn below the controls while error is true. — Field group On the web it is also what the form's own validation says of a required group left empty (CKG-8).
error boolean false Puts the set in the error condition: the error text is drawn, and each selection control that has an error condition of its own (a checkbox, a radio button) is drawn in it. What an answer means is the product's to validate; the group never sets this itself. One control of a valid group may still be in error by itself. — Field group Every checkbox of the set is drawn in its own error condition and exposed as invalid.
disabled boolean false Disables every control of the set and draws the frame as disabled. — Field group The value is kept, and on the web it is not submitted (CKG-6, CKG-8).
required boolean false What the form asks of the set: true exposes it as required and draws the required mark beside the label. It never validates: a missing answer is the product's to report with error. — Field group means at least one checkbox checked: on the web an empty list is reported to the form's own validation (CKG-8).
optional boolean false Draws the optional tag after the label and adds optionalText to the group's description, because assistive technology has no state for it. Ignored while required is true: a set is never both. — Field group
requiredMark auto | tag | asterisk | none "auto" How this set shows that it is required: tag is a small filled Tag with requiredText, asterisk is "*" after the label, none draws nothing and keeps the semantics. Auto takes comp.field-group.requirement.mark, which follows sys.behavior.requirement-mark, the system's one answer. Ignored unless required is true. — Field group
requiredText string "" The text of the required tag, in the product's language ("Required", "必須"). The product's: Tanrei has no word for it. Empty reads the product's words; with neither, FGR-24 says what is drawn. — Field group
optionalText string "" The text of the optional tag, in the product's language ("Optional", "任意"); also read to assistive technology as part of the description. The product's: Tanrei has no word for it. Empty reads the product's words. — Field group
orientation vertical | horizontal "vertical" vertical stacks the controls in one column, the default and the form to prefer: every label starts on one edge and is read down. horizontal lays them out in a row that wraps, for two or three short options or a row of fields. — Field group
selectAllLabel string "" Not empty: the group brings one more checkbox before the first, labelled by this text ("All of these", "Every weekday"), that checks or unchecks every enabled checkbox of the set at once and shows checked, unchecked or indeterminate from them (CKG-12, CKG-13). Empty, the default: there is none. The instance's own words: it names this set, so it is not read from the product's words.

الأحداث

الحدث الوصف
change The person switched a checkbox of the set, or activated the select-all checkbox; carries the new list, which the group already holds. Emitted once per action, by the group and not by its checkboxes. Not emitted when the product sets value.

العناصر

أنواع العناصر التي يكررها المكوّن. يسرد كل نموذج اختبار عناصره بالترتيب، وتسمّي كل منصة كل نوع بأسلوبها.

checkbox

A choice of the set: the Checkbox component with its own label, checked by the group's value, placed, spaced, disabled and put in its error condition by the group's frame, otherwise drawn and pressed as it is anywhere.

الخاصية النوع القيمة الافتراضية الوصف
value string "" What the choice stands for: an entry of the group's value while this checkbox is checked. Unique in the group and not empty. The group reads it from the item; it is not a prop of the Checkbox (on the web, the checkbox's own value attribute).
label string "" Its own label, as the Checkbox's label.
disabled boolean false As the Checkbox's disabled: one checkbox of an enabled group may be disabled by itself. The person cannot switch it, the select-all checkbox leaves it alone, and its entry stays in the value while the value holds it.
المواصفة Web SwiftUI Jetpack Compose Flutter React Native
العنصر tanrei-checkbox TanreiCheckbox TanreiCheckbox TanreiCheckbox Checkbox
value · الخاصية value value value entry entry
label · الخاصية label title label label label
disabled · الخاصية disabled disabled enabled enabled disabled
ملاحظات A tanrei-checkbox child: inside a tanrei-checkbox-group it takes its checked from the group's value and its own value attribute, submits nothing itself and fires no input or change of its own (CHK-23). A child with no value attribute has no value: the on a bare checkbox submits by default is not read inside a group. TanreiCheckbox.value is the checked state on this platform, so the entry a checkbox stands for has a name of its own: TanreiCheckbox<T>.inGroup(entry:, label:, enabled:) is the Checkbox itself, checked from the group and without value and onChanged. Checkbox's value is the checked state on this platform, so the entry a checkbox stands for has a name of its own: <Checkbox entry="email" label="Email" /> inside a CheckboxGroup is the Checkbox itself, checked from the group's context and without value and onValueChange.

الحالات

السلوك

متطلبات بصيغة EARS. يُختبر تنفيذ كل منصة مقابل هذه المعرّفات. يُعرض نص المتطلبات كما ورد في ملف المواصفة، بالإنجليزية.

المعرّف المتطلب
CKG-1 THE checkbox group SHALL be a field group whose spacing is controls, around its checkboxes: the field group itself, with the field group's own tokens, measures and sentences, and no copy of it — its rows, their order and their gaps (FGR-1), the label (FGR-2), the requirement, its mark and its words (FGR-4, FGR-5, FGR-6, FGR-24), the description, which stays while the group is in error (FGR-7), the error text (FGR-8), the column and the row that wraps (FGR-3, FGR-13), the disabled frame (FGR-14) and what an unknown value of required, optional, requiredMark or orientation does (FGR-22), each from the prop of the same name, which is the field group's. It SHALL have no look and no token of its own: it SHALL draw no container, edge, fill or elevation, SHALL add no padding around its rows and no distance between its checkboxes but the field group's, and SHALL leave each checkbox drawn from the checkbox's own tokens at the checkbox's own size (CHK-4, CHK-12, CHK-15).
CKG-2 THE checkbox group SHALL hold one value, a list of strings, and show as checked exactly those of its checkboxes whose value is in the list; WHILE the list is empty none SHALL be checked. WHEN the product sets value THE checkbox group SHALL check and uncheck its checkboxes to match, each over the checkbox's own selection motion (CHK-13), without emitting change and without moving focus. THE checkbox group SHALL keep in value an entry that is the value of none of its checkboxes, because the checkbox it belongs to may arrive later or be out of the set for now (a list of choices narrowed by a search), and SHALL give it back with the rest in change (CKG-4) and to a form (CKG-8). IF value holds one entry twice THEN THE checkbox group SHALL treat it as held once; IF two checkboxes carry one value THEN both SHALL be shown checked or unchecked together, and switching either SHALL switch the entry; IF a checkbox carries no value THEN it SHALL be drawn unchecked and a press on it SHALL change nothing and emit nothing, because the list has no entry to stand for it; and in debug builds THE checkbox group SHALL report each of the three.
CKG-3 WHERE the platform lets the product mark one checkbox as checked by itself (on the web, checked on a child element) and the product has not set value, THE checkbox group SHALL take as its value the values of the checkboxes so marked, in the order given, so that markup that says checked on some of its checkboxes is a group with that value, and a checkbox that arrives so marked SHALL add its value to the list. WHEN the product has set value, value SHALL decide: a checkbox that is first drawn or arrives marked against it SHALL be shown as value says. WHEN the product sets or clears checked on a checkbox the checkbox group already holds THE checkbox group SHALL add that checkbox's value to the list or take it out, without emitting change, so that the two never disagree.
CKG-4 WHEN the person switches one of the group's checkboxes — by pointer, touch, Space, a click on its label or assistive technology, as CHK-1 says of the checkbox — THE checkbox group SHALL add that checkbox's value to the list where the checkbox became checked and take it out where it became unchecked, and SHALL emit change exactly once, carrying the new list, with value already set when the event is received. The list it then holds SHALL be the values of its checked checkboxes in the order the checkboxes are given, not the order in which they were checked, followed by the entries that belong to no checkbox, in the order they had. No other checkbox SHALL change, and nothing the checkbox emits SHALL reach a listener on the group as a second change (CHK-23). A person can empty the list: unchecking the last checked checkbox emits change with an empty list.
CKG-5 THE checkbox group SHALL leave every enabled checkbox its own place in the focus order, in the order given, as the platform has it for checkboxes: Tab and Shift+Tab SHALL move from one checkbox to the next and out of the group at either end, and THE checkbox group SHALL handle no key — no arrow key moves focus or checks, and there is no single stop and no roving focus — because each checkbox is a choice of its own that a person may stop at and switch; Space is the checkbox's (CHK-1), and Enter is left to the form on the web. THE checkbox group SHALL NOT be a stop itself, and a press on its label, its requirement mark, its description or its error text SHALL check nothing and move no focus into the group (FGR-12). WHEN the product asks the group itself for focus, where the platform has such a call, THE checkbox group SHALL give focus to the first enabled checkbox it shows, the select-all checkbox where one is drawn.
CKG-6 WHILE disabled is true THE checkbox group SHALL be a disabled field group (FGR-14): its frame drawn from the field group's disabled tokens and every checkbox it holds disabled as the checkbox's own disabled does (CHK-3, CHK-8), the checked ones still shown checked; it SHALL emit no change and SHALL keep value. WHILE disabled is false THE checkbox group SHALL NOT enable a checkbox the product disabled itself: that one keeps its entry in the list WHILE the list holds it, is shown checked or unchecked as value says, cannot be switched by the person, and is left as it is by the select-all checkbox (CKG-13). THE checkbox group SHALL have no read-only state, because a checkbox has none and a composed component adds no state its members have not.
CKG-7 THE checkbox group SHALL take from required and optional what the form asks of the set, as a field group does (FGR-4): required means that the list holds at least one entry.
CKG-8 WHERE the platform has forms that submit named values (the web) THE checkbox group SHALL take part in its form as one control: WHILE it is not disabled it SHALL submit one entry under its own name for each entry of value, in the list's order, and nothing WHILE the list is empty — what checkboxes of one name submit by themselves, so that whatever receives the form reads the same list from either; SHALL return to the value it was first given WHEN the form is reset, without emitting change; SHALL be disabled WHILE the form disables the set it is in; SHALL report a missing value to the form's own validation WHILE required is true and the list is empty, in the product's words, because the platform has a message for one unchecked checkbox and none for a set; and its checkboxes, the select-all checkbox among them, SHALL submit nothing of their own, whatever name they carry (CHK-23), so that no entry is submitted twice. A checkbox the product disabled itself SHALL still have its entry submitted WHILE the list holds it, because the value is the group's and that checkbox's disabled says only that the person cannot switch it. WHERE the platform has no such forms value and change are the whole of it.
CKG-9 THE checkbox group SHALL be exposed to assistive technology as the field group it is, and SHALL add nothing to it: one group that contains its checkboxes, named by label whether or not the label is drawn (FGR-10); described by supportingText, errorText WHILE error is true, requiredText WHILE required is true and optionalText WHILE optional is true (FGR-11); and disabled WHILE disabled is true (FGR-14). A group has neither a required nor an invalid state, so the requirement is said in the product's words and each checkbox says invalid for itself. Each checkbox SHALL expose its own role, its name and its checked state (CHK-14), and the select-all checkbox its mixed state WHILE it is indeterminate. THE checkbox group SHALL NOT expose a second group around the first, SHALL give its checkboxes no position in a set, and SHALL NOT say how many are checked: a product that wants the count said writes it in supportingText.
CKG-10 WHEN a checkbox is added to the group, removed from it or moved, or its value or its disabled changes, while the group is shown THE checkbox group SHALL be laid out again as a field group is (FGR-23); SHALL check by value again (CKG-2), so that a checkbox that arrives with a value the list holds is shown checked, and SHALL keep the entry of a checked checkbox that leaves; SHALL set the select-all checkbox again (CKG-12); SHALL emit no change; and SHALL leave focus on the checkbox that has it.
CKG-11 THE checkbox group SHALL hold checkboxes and nothing else that can be operated. IF it holds no checkbox THEN THE checkbox group SHALL draw its rows without one and in debug builds report it (FGR-20); IF it holds another control, or a group of controls inside it, THEN in debug builds THE checkbox group SHALL report it and SHALL make no entry of its value from what that one holds. THE checkbox group SHALL NOT restyle a checkbox or change how it answers hover, focus or a press (CHK-5 to CHK-10), and SHALL NOT set indeterminate on a checkbox of the set: a checkbox of the set is in the list or it is not.
CKG-12 WHILE selectAllLabel is not empty THE checkbox group SHALL bring one more checkbox, the select-all checkbox: the Checkbox component itself, labelled by selectAllLabel, placed before the first checkbox of the set as one more control of the field group — the same distance from the next, in a column or in a row, the set not indented under it — and so disabled and put in its error condition with the others (CKG-6, CKG-7). It SHALL stand for the checkboxes of the set that the product did not disable one by one: checked WHILE each of them is checked, indeterminate WHILE some are and some are not, unchecked WHILE none is (CHK-4), and disabled WHILE there is no such checkbox. It SHALL have no value, SHALL be no entry of the list, and SHALL follow every change of value and of the set at once, whoever made the change. WHILE selectAllLabel is empty THE checkbox group SHALL bring none.
CKG-13 WHEN the person activates the select-all checkbox while it is unchecked or indeterminate THE checkbox group SHALL check every checkbox of the set that the product did not disable itself, as CHK-2 says of an indeterminate checkbox, and while it is checked SHALL uncheck every one of them; a checkbox the product disabled SHALL stay as it is, and an entry of value that belongs to no checkbox SHALL stay in the list. THE checkbox group SHALL emit change exactly once, carrying the list after the change (CKG-4), and nothing of the select-all checkbox's own SHALL reach a listener on the group.
CKG-14 THE checkbox group SHALL add nothing of its own to how its members answer the layout direction, enlarged text and forced colors. WHERE the layout direction is right-to-left it SHALL be mirrored as the field group is (FGR-18), SHALL take its direction from where it is used and follow a change of it at once (FGR-19), keeping its value and its focus, and SHALL lay out each of its texts by that text's own direction (FGR-21), each checkbox mirroring itself (CHK-15, CHK-20, CHK-21); it has no key to exchange (CKG-5). WHILE the text size is enlarged it SHALL grow as the field group does (FGR-16): every text wraps, a row becomes a column where one line no longer holds two checkboxes, and the boxes keep their size. WHERE the platform draws with a person's own forced colors it SHALL be drawn as the field group is there (FGR-17), the error carried by the words of errorText and by each checkbox's invalid state, never by a color of the group's.
CKG-15 WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE checkbox group SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on the group of the field group it is (CKG-9) — an id reference by the elements it names in the host's tree or a tree around it, a description after its own — except those the checkbox group owns (aria-label, aria-labelledby, aria-disabled, aria-required, aria-invalid, aria-errormessage), which it SHALL move and not expose: its name is label and its states are its props (CKG-9). WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE checkbox group SHALL take it off that element. WHEN the product sets an aria- attribute the checkbox group owns THE checkbox group SHALL report it in debug builds.

مطابقة الأسماء بين المنصات

التكافؤ لا يعني واجهات برمجية متطابقة. تعبّر كل منصة عن العقد نفسه بأسلوبها.

المواصفة Web SwiftUI Jetpack Compose Flutter React Native
المكوّن tanrei-checkbox-group TanreiCheckboxGroup TanreiCheckboxGroup TanreiCheckboxGroup CheckboxGroup
value · الخاصية value selection values values value
label · الخاصية label label label labelText label
labelHidden · الخاصية labelHidden labelsHidden labelHidden labelHidden labelHidden
supportingText · الخاصية supportingText supportingText supportingText helperText supportingText
errorText · الخاصية errorText errorText errorText errorText errorText
error · الخاصية error error isError isError error
disabled · الخاصية disabled disabled enabled enabled disabled
required · الخاصية required isRequired required required required
optional · الخاصية optional isOptional optional optional optional
requiredMark · الخاصية requiredMark requiredMark requiredMark requiredMark requiredMark
requiredText · الخاصية requiredText requiredText requiredText requiredText requiredText
optionalText · الخاصية optionalText optionalText optionalText optionalText optionalText
orientation · الخاصية orientation orientation orientation orientation orientation
selectAllLabel · الخاصية selectAllLabel selectAllLabel selectAllLabel selectAllLabel selectAllLabel
change · الحدث change selection onValuesChange onChanged onValueChange
ملاحظات <tanrei-checkbox-group label="Notify me by" name="notify"><tanrei-checkbox value="email" label="Email" checked></tanrei-checkbox>…</tanrei-checkbox-group>; class TanreiCheckboxGroup; in @tanrei/react, CheckboxGroup with value and onChange. Composed as every composed element on the web is (a custom element whose shadow root holds its members' own elements); what differs here: the members that hold the value are the product's own children. The shadow root holds one <tanrei-field-group spacing="controls"> — the member's own element, not drawing code shared with it — around, in this order, the select-all <tanrei-checkbox part="select-all"> while select-all-label is given, and a <slot>; the product's checkboxes stay in its light DOM and are assigned through the group's slot into the field group's. The eleven props that are the field group's are set on that element as they are given, and its documented parts are exported under its own names (exportparts); the group writes none of its custom properties, so --tanrei-comp-field-group-* set on the host is inherited by the field group inside. Name, description and states are the field group's own fieldset and legend, once: the host has no role. The field group gives disabled, the error condition and the error text to each checkbox by the tanrei-field-connect event it already answers — a slotted checkbox's event passes the field group on its composed path before it reaches the host, so the group forwards nothing. value is a property only, an array that is copied in and out; there is no value attribute, because the first value is written where HTML writes it, as checked on the children (CKG-3), and that is also what a reset returns to where the property was never set. A checkbox finds its group with closest('tanrei-checkbox-group') when it connects; the group's checkboxes are those among its descendants whose nearest checkbox group it is, found again when its child list changes. A checkbox inside a group fires no input and no change at all — stopped at the group they would still pass a capture listener on an ancestor — it tells its group, which sets value and fires input and one change, a bubbling CustomEvent whose detail.value is a copy of the list; a listener set on a checkbox inside a group hears nothing. A form-associated custom element (static formAssociated = true): name is a web attribute, not a spec prop; it submits a FormData of one entry per value under name (ElementInternals.setFormValue), restores the list on navigation (formStateRestoreCallback), follows <fieldset disabled>, and reports valueMissing while required and the list is empty, anchored on its first enabled checkbox, with the message errorText, else the required text (the instance's or the product's), else label — never a browser's sentence for one unchecked box. The host is not focusable and does not delegate focus; focus() moves to the first enabled checkbox. Attributes are kebab-case: label-hidden, supporting-text, error-text, required-mark, required-text, optional-text, select-all-label. The host is display: block. Without script the element is not defined and draws nothing of its own, as every Tanrei element with a shadow root; a page that must work without script writes a native fieldset of native checkboxes of one name, which submits the same entries. Words: the element has no words of its own; required-text and optional-text left empty read the product's words through the field group, and select-all-label is the instance's alone. TanreiCheckboxGroup("Notify me by", selection: $channels, supportingText:, errorText:, error:, required:, optional:, orientation:, selectAllLabel:) { TanreiCheckbox("Email", value: Channel.email) … }, generic over a Hashable value: selection is a Binding<Set<V>>, and writing it is the change event; a set has no order to keep (CKG-4). The view is a TanreiFieldGroup around its content — the field group's own view, which reads comp.field-group from the environment, so one group is set apart with .tanreiTheme(_:) on it — and the checkboxes inside read and write the selection through the environment: TanreiCheckbox(_:value:) is the Checkbox with its isOn bound to membership. labelHidden follows .labelsHidden() and disabled follows .disabled(_:). The select-all checkbox is a TanreiCheckbox with isIndeterminate. No forms: CKG-8 does not apply. The product's words are read from the \.tanreiWords environment value. TanreiCheckboxGroup(label = "Notify me by", values = channels, onValuesChange = { channels = it }, supportingText = …, isError = …, required = …, optional = …, orientation = …, selectAllLabel = …) { TanreiCheckbox(value = "email", label = "Email") … }: controlled, as Compose is — values is a Set<T>, the group calls onValuesChange and the caller moves it. The composable is a TanreiFieldGroup around its content, which runs in a TanreiCheckboxGroupScope whose TanreiCheckbox(value, label) is the Checkbox with checked and its click taken from the group; one group is set apart with a TanreiTheme around it. enabled is the inverse flag. The select-all checkbox is the TanreiCheckbox(state: ToggleableState, onClick) overload. No forms: CKG-8 does not apply. The product's words are read from LocalTanreiWords. TanreiCheckboxGroup<T>(values:, onChanged:, labelText: 'Notify me by', helperText: …, errorText: …, isError: …, required: …, optional: …, orientation: …, selectAllLabel: …, children: [TanreiCheckbox<T>.inGroup(entry:, label:), …]): values is a Set<T>. The widget builds a TanreiFieldGroup around its children and an inherited scope that gives each checkbox its checked state and takes its change; one group is set apart with a TanreiTheme around it. enabled is the inverse flag. The select-all checkbox is a TanreiCheckbox with tristate. FormField integration is the product's: CKG-8 does not apply. The product's words are read from the TanreiWords inherited widget. <CheckboxGroup label="Notify me by" value={channels} onValueChange={setChannels} supportingText="…" selectAllLabel="…"><Checkbox entry="email" label="Email" />…</CheckboxGroup>: controlled; value is an array of strings in the order of the checkboxes. The component renders a FieldGroup around its children and a context that gives each checkbox its checked state; one group is set apart with a provider around it. The select-all checkbox is a Checkbox with indeterminate. Follows the app's direction where an ancestor's is not known. No forms: CKG-8 does not apply. The product's words are read from the TanreiWordsProvider context.

الرموز

الرمز يشير إلى القيمة المحلولة (فاتح)
--tanrei-comp-field-group-error-text-gap sys.space.space50 4px
--tanrei-comp-field-group-field-min-width — 144px
--tanrei-comp-field-group-gap-inline sys.space.space200 16px
--tanrei-comp-field-group-gap-controls sys.space.space100 8px
--tanrei-comp-field-group-gap-fields sys.space.space300 24px
--tanrei-comp-field-group-label-gap sys.space.space100 8px
--tanrei-comp-field-group-requirement-asterisk-gap sys.space.space25 2px
--tanrei-comp-field-group-requirement-gap sys.space.space100 8px
--tanrei-comp-field-group-requirement-mark sys.behavior.requirement-mark 0
--tanrei-comp-field-group-standard-disabled-error-text-color — #1b1b1b · 38%
--tanrei-comp-field-group-standard-disabled-error-label-color — #1b1b1b · 38%
--tanrei-comp-field-group-standard-disabled-error-required-asterisk-color — #1b1b1b · 38%
--tanrei-comp-field-group-standard-disabled-error-supporting-text-color — #1b1b1b · 38%
--tanrei-comp-field-group-standard-disabled-label-color — #1b1b1b · 38%
--tanrei-comp-field-group-standard-disabled-required-asterisk-color — #1b1b1b · 38%
--tanrei-comp-field-group-standard-disabled-supporting-text-color — #1b1b1b · 38%
--tanrei-comp-field-group-standard-error-text-color sys.color.error #cd262f
--tanrei-comp-field-group-standard-error-label-color sys.color.on-surface #1b1b1b
--tanrei-comp-field-group-standard-error-required-asterisk-color sys.color.primary #1b1b1b
--tanrei-comp-field-group-standard-error-supporting-text-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-group-standard-label-color sys.color.on-surface #1b1b1b
--tanrei-comp-field-group-standard-required-asterisk-color sys.color.primary #1b1b1b
--tanrei-comp-field-group-standard-supporting-text-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-group-supporting-text-gap sys.space.space50 4px
--tanrei-comp-field-group-label-typescale sys.typescale.label 500 14px/1.4286
--tanrei-comp-field-group-supporting-text-typescale sys.typescale.label-small 500 12px/1.3333

نماذج الاختبار

عروض مرجعية. تلتقط كل المنصات لقطة لكل نموذج بالمعرّف نفسه حتى يمكن مقارنة النتائج.

مولَّد من specs/checkbox-group.spec.json, tokens/comp/field-group.tokens.json, design/tokens/

ما يرسمه الويب بطريقة مختلفة

  • جذر الظل (shadow root) في العنصر فيه عنصر <tanrei-field-group> حول خانة تحديد الكل، ما دامت select-all-label معطاة، وحول منفذ. وخانات الاختيار تبقى عناصرك الفرعية أنت. واستيراد العنصر يعرّف العضوين كليهما.
  • الخاصية value خاصية للعنصر فقط: مصفوفة، تُنسخ عند الدخول وعند الخروج. وليست هناك خاصية HTML (attribute) باسم value، لأن القائمة في خاصية HTML تحتاج إلى فاصل قد تحويه قيمة، ولأن في HTML هيئة لذلك سلفًا: الخاصية checked على كل عنصر فرعي.
  • خانة الاختيار التي ليست لها خاصية HTML value ولا قيمة معيَّنة لا قيمة لها: فالقيمة «on» التي ترسلها خانة اختيار مجرَّدة لا تُقرأ في مجموعة. تُرسم غير محدَّدة، وتبلّغ بنيات التنقيح (debug) عنها.
  • العنصر مرتبط بالنماذج (form-associated). يأخذ name و form، ويرسل مُدخلة واحدة تحت name لكل قيمة، وهو ما ترسله خانات اختيار أصلية لها اسم واحد. وخانات الاختيار فيه لا ترسل شيئًا، أيًّا كان name الذي تحمله. ويعود عند إعادة الضبط إلى قيمته الأولى، ويتبع عنصر <fieldset> المعطَّل، ويبلّغ بأن القيمة ناقصة ما دامت required معيَّنة والقائمة فارغة. والرسالة هي error-text، وإلا فنص المطلوب، وإلا فقيمة label: أعطِ error-text من البداية، لا حين تُعيَّن error فقط.
  • الحدث change من النوع CustomEvent، و detail.value فيه نسخة من القائمة؛ ويصدر الحدث input قبله. والمستمع الموضوع على خانة اختيار داخل المجموعة لا يسمع أيًّا منهما.
  • الأجزاء: field-group هو الإطار، ولأجزائه هنا الأسماء نفسها التي لها في المستوى الأدنى: label، requirement-label، supporting-text، error-text. والجزء select-all هو خانة تحديد الكل، وأجزاؤها select-all-container و select-all-box و select-all-mark و select-all-label. وخانات الاختيار التي من عندك تُنسَّق كما تُنسَّق في أي مكان، بالمحدِّد tanrei-checkbox::part(…).
  • العنصر نفسه غير قابل للتركيز. فالدالة focus() تذهب إلى أول خانة اختيار غير معطَّلة، وعنصر <label for> من عند الصفحة ينقل التركيز إليها.
  • ليس للعنصر دور. سمِّه بالخاصية label، ومعها label-hidden حيث تُرسم التسمية في مكان آخر، ولا تسمِّه أبدًا بالخاصية aria-label، فهي لا تسمّي شيئًا هنا.
  • خصائص HTML تُكتب بصيغة kebab-case: label-hidden، supporting-text، error-text، required-mark، required-text، optional-text، select-all-label.
  • قبل أن يُعرَّف العنصر، ومن دون سكربت، لا يُرسم شيء من عنده: تظهر خانات الاختيار محتوى عاديًّا. والصفحة التي يجب أن تعمل بلا سكربت تكتب عنصر <fieldset> أصليًّا فيه خانات اختيار أصلية لها name واحد، وهو يرسل المُدخلات نفسها.

الإرشادات

افعل

  • اكتب التسمية على أنها السؤال، وتسمية كل خانة اختيار على أنها جواب واحد عنه.
  • قل كيف يُجاب في supportingText: «اختر كل ما ينطبق.»
  • فضِّل العمود. ولا تستخدم الصف إلا لبضع تسميات قصيرة.
  • أعطِ errorText حين تجعل المجموعة مطلوبة، ليقول تحقق النموذج نفسه ذلك بكلماتك.
  • استخدم خانة تحديد الكل لمجموعة من ستة خيارات أو أكثر، ولعوامل التصفية، ولمجموعات الأذونات.

لا تفعل

  • لا تستخدم مجموعة خانات الاختيار لجواب واحد من بضعة: فتلك مجموعة أزرار الاختيار.
  • لا تعطِ خانات الاختيار name لترسلها: فالمجموعة ترسل القائمة تحت اسمها هي.
  • لا تضع فيها أي شيء يمكن تشغيله وليس خانة اختيار. فبنيات التنقيح تبلّغ عنه، ولا يصنع مُدخلة في القيمة.
  • لا تُزِح المجموعة تحت خانة تحديد الكل بمسافة بادئة لتُظهر تسلسلًا هرميًّا. فالخيارات داخل الخيارات شجرة.
  • لا تسمِّ المجموعة بالخاصية aria-label. وحيث يجب ألا تُرسم تسمية، أعطِ label و labelHidden.

إمكانية الوصول

الدور
group
التسمية
label names the group, drawn or not (labelHidden). Each checkbox keeps its own name, its own label beside it; the select-all checkbox is named by selectAllLabel. The group's description is the field group's: supportingText, then errorText while error is true, then requiredText while the group is required, then optionalText while it is optional (FGR-11). A group has no required and no invalid state: the requirement is said in the product's words, and each checkbox of a group in error is exposed as invalid and described by errorText. How many are checked is not said unless the product writes it in supportingText.
الحد الأدنى للهدف
تستوفي مساحة اللمس الحد الأدنى لحجم الهدف حتى لو كان الحجم المرئي أصغر. minimum 32px · pointer 44px · spacing 8px · touch 48px

لوحة المفاتيح

المفاتيح الإجراء
Tab / Shift+Tab Moves focus to each enabled checkbox of the set in the order given — the select-all checkbox first where there is one — and out of the group. Every checkbox is a stop; the group is not (CKG-5).
Space Switches the focused checkbox (CHK-1); on the select-all checkbox, checks every enabled checkbox of the set, or unchecks them all where all were checked (CKG-13).
Arrow keys Nothing: a set of checkboxes has no arrow keys on any platform, because moving among them must not change them and each is a stop already.
Enter Nothing on the web, where it submits the form; switches the focused checkbox where the platform activates any focused control with Enter (Android, tvOS), as CHK-1 says.

ملاحظات

  • Not a target itself: the group takes no press and is not a focus stop (CKG-5), so minimumTarget holds through its checkboxes, each of which keeps a whole touch target of its own at the distance the field group puts between them (CHK-7, FGR-3).
  • The checkbox group is a field group of checkboxes that owns their value (composed: the field group frames it, its checkboxes hold its value). What it adds to the two is what every product otherwise writes: the list of checked values and one change for it, one name in a form with reset and the form's own check that a required set is not empty, and the select-all checkbox's three states. It adds no look and has no tokens of its own.
  • One level down is always open: a field group around checkboxes, each checked by the product, is the same picture, the same group, the same names, descriptions and states. Take it where each checkbox must have a name of its own in the form, where the set holds something that is not a checkbox, or where the product wants its own rule for what "all" means.
  • Beside the radio group. A radio group has one answer, so it is one stop in the focus order, its arrow keys move and select, and its role has a required and an invalid state. A checkbox group has a list: every checkbox is a stop and Space switches it, there are no arrow keys, and its role is the plain group's — the requirement is said in words and each checkbox says invalid for itself. A radio group in error leaves its rings as they are; a checkbox group in error marks every box, because a checkbox has an error condition and a radio button has none.
  • required means "at least one". A least or a greatest number of choices ("choose up to three") is the product's rule: it reads the length of the list in change, sets error and writes errorText with the number in its own words, or disables what may no longer be chosen. The group knows no number, because it would have no words to say it with.
  • The select-all checkbox stands for the checkboxes the group holds and a person can switch, never for choices the product has not given it. It is one more stop before the set. It is not the place for a hierarchy: choices inside choices are a tree.
  • A disabled group is not submitted; a checkbox disabled by itself in an enabled group keeps its entry in the value and is submitted with it. A choice that is always on ("Email, required for your account") is therefore one disabled, checked checkbox, and needs no hidden field beside it.
  • When a checkbox group, and when something else. Several of a few choices that are all worth seeing at once, in a form or a setting: a checkbox group, of up to about seven. One of a few: a radio group. One thing on or off, on its own: a checkbox, or a switch where it takes effect at once. Several of many, or where there is little room: a list with multiple selection, or a select. Rows of a table chosen for an action: the table's own selection. Things on or off that are not one answer — each with a name of its own in the form — or a set of switches: a field group.
  • On the web the group's shadow root holds the field group's own element around a slot, and the checkboxes stay the product's children: the group is the field group's `fieldset` with its `legend`, exposed once.
  • Heights are the texts' and the checkboxes': at 200% text size every text wraps, a row becomes a column, and nothing is cut (WCAG 1.4.4, 1.4.10).
  • How a state looks is a value decision of the active design system; components read the state's tokens and never compute the effect themselves.

مولَّد من specs/checkbox-group.spec.json, tokens/sys/measure.tokens.json

ما يتكفل به المكوّن

  • هي مجموعة واحدة، هي مجموعة الحقول، تحتوي خانات الاختيار التي لها. اسمها label، مرسومةً كانت أو غير مرسومة؛ ووصفها النص المساعد، ونص الخطأ ما دامت في حالة الخطأ، والمطلوب أو الاختياري بكلمات المنتج.
  • ليست للمجموعة حالة للمطلوب ولا حالة لعدم الصلاحية. فالمطلوب أو الاختياري يُقال بالكلمات، وكل خانة اختيار في مجموعة في حالة الخطأ تُعرَض للتقنيات المساعدة على أنها غير صالحة ويصفها نص الخطأ.
  • كل خانة اختيار تحتفظ بدورها واسمها وحالة تحديدها. وخانة تحديد الكل تقول إنها مختلطة ما دام بعضها محدَّدًا. وليس لأي خانة اختيار موضع في مجموعة، ولا يُقال كم خانة محدَّدة.
  • كل خانة اختيار غير معطَّلة موضع توقف مستقل للمفتاح Tab، وخانة تحديد الكل أولًا. والمفتاح Space يبدّل الخانة التي عليها التركيز. وليست هناك مفاتيح أسهم، والمفتاح Enter متروك للنموذج.
  • الضغط على التسمية أو علامة المطلوب أو الاختياري أو الوصف أو نص الخطأ لا يحدّد شيئًا ولا ينقل التركيز.
  • الخطأ الذي يظهر والتركيز على إحدى خانات الاختيار تُعلِنه مجموعة الحقول مرة واحدة، بتهذيب.
  • الاتجاه والنص المكبَّر والألوان المفروضة (forced colors) يستجيب لكل منها كل عضو بطريقته: في تخطيط من اليمين إلى اليسار ينعكس الإطار وكل خانة اختيار؛ وعند تكبير النص إلى 200% يلتفّ كل نص، ويصير الصف عمودًا، ولا يُمرَّر شيء جانبيًّا.
  • ليست لها كلمات من عندها. والخاصيتان requiredText و optionalText إذا تُركتا فارغتين قرأتهما مجموعة الحقول من كلمات المنتج.

فجوات معروفة على الويب: ما تقوله قارئات الشاشة عن المجموعة قُرئ من أشجار إمكانية الوصول في المتصفحات، ولم يُسمع بقارئ شاشة. ويعطي Chromium العنصر عقدة خاصة به في شجرة إمكانية الوصول، لأن النموذج يتحقق منه: عقدة بلا دور ولا اسم، حول المجموعة.

ما عليك فعله

  • أعطِ label دائمًا، وأعطِ كل خانة اختيار label.
  • أعطِ requiredText و optionalText، على المجموعة أو مرة واحدة للمنتج كله، حيث تكون المجموعة مطلوبة أو اختيارية: فليست للمجموعة حالة للمطلوب، والكلمات هي التي تقوله.
  • قل ما الخطأ في errorText، وكيف يُصحَّح. واللون ليس الدليل الوحيد أبدًا.
  • حيث يهمّ عدد الاختيارات («اختير 2 من 5»)، اكتبه في supportingText: فهو لا يُعلَن بغير ذلك.