Skip to content

Commit 75c02ee

Browse files
committed
refactor: better positioning
1 parent 4f635b8 commit 75c02ee

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,15 @@
113113

114114
// counter styling
115115
%form-element-counter {
116-
// TODO: add CSS anchor positioning
116+
&:has(+ .description) {
117+
float: right;
118+
}
119+
120+
&:not(:has(+ .description)) {
121+
position: absolute;
122+
// stylelint-disable-next-line property-no-unknown
123+
inset-area: block-end span-inline-start;
124+
}
117125

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
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 }}"></output>{{/if }}
22+
{{#if maxlength }}<output for="{{ id }}" id="result_{{ id }}" anchor="{{ id }}"></output>{{/if }}
2323
{{#if description }}<p{{#if describedbyid }} id="{{ describedbyid }}"{{/if }} class="description">{{{ description }}}</p>{{/if }}
2424
{{#if datalist }}<datalist id="datalist{{ id }}">
2525
{{#each datalistItems }}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@
158158
+ label
159159
+ output {
160160
@extend %form-element-counter;
161-
162-
float: right;
163161
}
164162
}
165163

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

Lines changed: 1 addition & 1 deletion
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)