MDL-67968 form: grouped element label fix

This commit is contained in:
Shamim Rezaie
2020-03-07 04:08:10 +11:00
parent 9ce2442ea9
commit eebe003104
4 changed files with 58 additions and 30 deletions
@@ -1,10 +1,13 @@
{{< core_form/element-template }}
{{< core_form/element-group }}
{{$element}}
<span class="fdate_selector d-flex">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</span>
<fieldset class="m-0 p-0 border-0" id="{{element.id}}">
<legend class="sr-only">{{label}}</legend>
<span class="fdate_selector d-flex">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</span>
</fieldset>
{{/element}}
{{/ core_form/element-template }}
{{/ core_form/element-group }}
@@ -1,10 +1,13 @@
{{< core_form/element-template }}
{{< core_form/element-group }}
{{$element}}
<div class="fdate_time_selector d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
<fieldset class="m-0 p-0 border-0" id="{{element.id}}">
<legend class="sr-only">{{label}}</legend>
<div class="fdate_time_selector d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
</fieldset>
{{/element}}
{{/ core_form/element-template }}
{{/ core_form/element-group }}
+24 -4
View File
@@ -1,8 +1,28 @@
{{< core_form/element-template }}
{{$label}}
{{^element.hiddenlabel}}
<p id="{{element.id}}_label" class="col-form-label d-inline" aria-hidden="true">
{{{label}}}
</p>
{{/element.hiddenlabel}}
{{/label}}
{{$element}}
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
<fieldset class="m-0 p-0 border-0">
<legend class="sr-only">{{label}}</legend>
<div class="d-flex flex-wrap">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
</fieldset>
{{/element}}
{{/ core_form/element-template }}
{{#js}}
require(['jquery'], function($) {
$('#{{element.id}}_label').css('cursor', 'default');
$('#{{element.id}}_label').click(function() {
$('#{{element.id}}').find('button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':enabled').first().focus();
});
});
{{/js}}
+12 -10
View File
@@ -49,16 +49,18 @@
{{#advanced}}<abbr class="initialism text-info" title="{{#str}}advanced{{/str}}">!</abbr>{{/advanced}}
{{{helpbutton}}}
</span>
{{^element.staticlabel}}
<label class="col-form-label d-inline {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}" for="{{element.id}}">
{{{label}}}
</label>
{{/element.staticlabel}}
{{#element.staticlabel}}
<span class="col-form-label d-inline-block {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}">
{{{label}}}
</span>
{{/element.staticlabel}}
{{$ label }}
{{^element.staticlabel}}
<label class="col-form-label d-inline {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}" for="{{element.id}}">
{{{label}}}
</label>
{{/element.staticlabel}}
{{#element.staticlabel}}
<span class="col-form-label d-inline-block {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}">
{{{label}}}
</span>
{{/element.staticlabel}}
{{/ label }}
</div>
<div class="col-md-9 form-inline felement" data-fieldtype="{{element.type}}">
{{$ element }}