Skip to content

Commit 464152c

Browse files
authored
fix(input): some counter related styles (#813)
* fix(input): some counter related styles * refactor: better positioning
1 parent a47009b commit 464152c

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

source/_patterns/01-elements/_form-elements.scss

+8-2
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,15 @@
113113

114114
// counter styling
115115
%form-element-counter {
116-
margin-top: to-rem($pxValue: 12);
116+
&:has(+ .description) {
117+
float: right;
118+
}
117119

118-
// TODO: add CSS anchor positioning
120+
&:not(:has(+ .description)) {
121+
position: absolute;
122+
// stylelint-disable-next-line property-no-unknown
123+
inset-area: block-end span-inline-start;
124+
}
119125

120126
// Description styles
121127
// TODO: This probably still needs to get further changed to a general "hint" pattern or similar

source/_patterns/01-elements/input/input.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
aria-hidden="true"
2020
id="{{ id }}-label"
2121
{{#if labelHidden }} data-label-hidden="true"{{/if }}>{{ label }}</label>
22+
{{#if maxlength }}<output for="{{ id }}" id="result_{{ id }}" anchor="{{ id }}"></output>{{/if }}
2223
{{#if description }}<p{{#if describedbyid }} id="{{ describedbyid }}"{{/if }} class="description">{{{ description }}}</p>{{/if }}
2324
{{#if datalist }}<datalist id="datalist{{ id }}">
2425
{{#each datalistItems }}
2526
<option{{#if value }} value="{{ value }}"{{/if }}>{{ text }}</option>
2627
{{/each }}
2728
</datalist>{{/if }}
28-
{{#if maxlength }}<output for="{{ id }}" id="result_{{ id }}"></output>{{/if }}

source/_patterns/01-elements/input/input.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
margin-bottom: -#{to-rem($pxValue: 18)};
107107
transform: translate($db-spacing-m, -#{to-rem($pxValue: 41)});
108108

109-
& + .description {
109+
& + output,
110+
& ~ .description {
110111
margin-top: 0;
111112
}
112113
}

source/_patterns/01-elements/textarea/textarea.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
{{#if maxlength }} maxlength="{{ maxlength }}"
1111
oninput="result_{{ id }}.value=this.value.length+'/'+this.attributes.maxlength.value"{{/if }}
1212
{{#if variant}} data-variant="{{variant}}"{{/if }}>{{ value }}</textarea>
13-
{{#if maxlength }}<output for="{{ id }}" id="result_{{ id }}"></output>{{/if }}
13+
{{#if maxlength }}<output for="{{ id }}" id="result_{{ id }}" anchor="{{ id }}"></output>{{/if }}
1414
{{#if description }}<p{{#if describedbyid }} id="{{ describedbyid }}"{{/if }} class="description">{{{ description }}}</p>{{/if }}

0 commit comments

Comments
 (0)