From 520feeeba94963330f852178475f5ba14394cec1 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Fri, 15 Dec 2023 08:54:38 +0100 Subject: [PATCH] feat(form elements): provide possibility to visually hide the label (#628) * feat: provide general styling for visually hidden labels * docs: typo * feat: provided the possibility for all forms to visually hide the label * feat: provided the possibility for all forms to visually hide the label * Update _form-elements.scss * refactor: added missing references * refactor: not providing an empty option on hidden label --- source/_patterns/01-elements/_form-elements.scss | 6 ++++++ .../_patterns/01-elements/checkbox/checkbox.hbs | 2 +- .../_patterns/01-elements/checkbox/checkbox.scss | 3 +++ .../checkbox/checkbox~indeterminate.md | 2 +- .../checkbox/checkbox~label-hidden.json | 4 ++++ .../checkbox/checkbox~label-hidden.md | 11 +++++++++++ .../checkbox~on-dark-background-indeterminate.md | 2 +- source/_patterns/01-elements/input/input.hbs | 3 ++- source/_patterns/01-elements/input/input.scss | 16 +++++++++++++--- .../01-elements/input/input~hidden-label.json | 4 ++++ .../01-elements/input/input~hidden-label.md | 13 +++++++++++++ source/_patterns/01-elements/radio/_radio.hbs | 2 +- source/_patterns/01-elements/radio/radio.scss | 4 ++++ source/_patterns/01-elements/radio/radios.hbs | 2 +- .../01-elements/radio/radios~label-hidden.json | 4 ++++ .../01-elements/radio/radios~label-hidden.md | 11 +++++++++++ source/_patterns/01-elements/select/select.hbs | 4 ++-- source/_patterns/01-elements/select/select.scss | 7 +++++++ .../01-elements/select/select~hidden-label.json | 5 +++++ .../01-elements/select/select~hidden-label.md | 13 +++++++++++++ .../_patterns/01-elements/textarea/textarea.hbs | 2 +- .../_patterns/01-elements/textarea/textarea.scss | 5 +++++ .../textarea/textarea~hidden-label.json | 5 +++++ .../textarea/textarea~hidden-label.md | 13 +++++++++++++ 24 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 source/_patterns/01-elements/checkbox/checkbox~label-hidden.json create mode 100644 source/_patterns/01-elements/checkbox/checkbox~label-hidden.md create mode 100644 source/_patterns/01-elements/input/input~hidden-label.json create mode 100644 source/_patterns/01-elements/input/input~hidden-label.md create mode 100644 source/_patterns/01-elements/radio/radios~label-hidden.json create mode 100644 source/_patterns/01-elements/radio/radios~label-hidden.md create mode 100644 source/_patterns/01-elements/select/select~hidden-label.json create mode 100644 source/_patterns/01-elements/select/select~hidden-label.md create mode 100644 source/_patterns/01-elements/textarea/textarea~hidden-label.json create mode 100644 source/_patterns/01-elements/textarea/textarea~hidden-label.md diff --git a/source/_patterns/01-elements/_form-elements.scss b/source/_patterns/01-elements/_form-elements.scss index d88bff7d20..edd678234b 100644 --- a/source/_patterns/01-elements/_form-elements.scss +++ b/source/_patterns/01-elements/_form-elements.scss @@ -33,6 +33,12 @@ } } +%form-label { + &[data-label-hidden="true"] { + @include a11y-visually-hidden($partial: $partial); + } +} + // ### Style variations // Semitransparent %form-element-semitransparent { diff --git a/source/_patterns/01-elements/checkbox/checkbox.hbs b/source/_patterns/01-elements/checkbox/checkbox.hbs index 0dc76c072c..eec60f4aa1 100644 --- a/source/_patterns/01-elements/checkbox/checkbox.hbs +++ b/source/_patterns/01-elements/checkbox/checkbox.hbs @@ -5,7 +5,7 @@ value="{{ value }}" {{#if describedbyid }} aria-describedby="{{ describedbyid }}"{{/if }} {{#if invalid }} aria-invalid="{{ invalid }}"{{/if }}> - + {{#if indeterminate}}