Keep the comment box as tall as the longest comment
The stage centres its content vertically, so a multi-line comment moved the whole slide while the comments rotated. All comments now share one grid cell (the others invisible), so the box keeps the height of the longest one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8bc2723688
commit
bbe3dfcc8e
3 files changed
+20
-3
No files matched your search
@@ -586,6 +586,10 @@ button.qa-steps__step:hover:not(:disabled) { color: var(--text); border-color: v
|
||||
.comments__text::before { content: '„'; }
|
||||
.comments__text::after { content: '“'; }
|
||||
.comments__value { margin: 6px 0 0; color: var(--muted); font-size: .9em; }
|
||||
/* all comments share one grid cell (invisible sizers): the box keeps the height of the longest one */
|
||||
.comments__body { display: grid; }
|
||||
.comments__body > * { grid-area: 1 / 1; min-width: 0; }
|
||||
.comments__sizer { visibility: hidden; }
|
||||
.comments__progress { height: 4px; margin-top: 14px; border-radius: 2px; background: var(--border); overflow: hidden; }
|
||||
.comments__progress[hidden] { display: block; visibility: hidden; } /* keeps the layout steady while paused */
|
||||
.comments__progress-fill { height: 100%; background: var(--primary); transform: scaleX(0); transform-origin: left; }
|
||||
|
||||
+15
-2
@@ -342,10 +342,23 @@
|
||||
text: text
|
||||
});
|
||||
};
|
||||
// Every comment sits invisibly in the same grid cell as the one shown, so the box is as
|
||||
// tall as the longest comment and the centred stage does not jump while they rotate.
|
||||
var sizers = items.length < 2 ? [] : items.map(function (item) {
|
||||
var hasValue = item.value !== null && item.value !== undefined;
|
||||
return el('div', { class: 'comments__sizer', 'aria-hidden': 'true' }, [
|
||||
el('blockquote', { class: 'comments__text', text: item.text }),
|
||||
hasValue ? el('p', { class: 'comments__value', text: 'Bewertung: ' + Comments.format(item.value) }) : null
|
||||
]);
|
||||
});
|
||||
var node = el('section', { class: 'comments', 'data-comments': '', 'aria-label': 'Kommentare' }, [
|
||||
el('p', { class: 'comments__counter', 'data-comment-counter': '' }),
|
||||
el('blockquote', { class: 'comments__text', 'data-comment-text': '' }),
|
||||
el('p', { class: 'comments__value', 'data-comment-value': '' }),
|
||||
el('div', { class: 'comments__body' }, sizers.concat([
|
||||
el('div', { class: 'comments__current' }, [
|
||||
el('blockquote', { class: 'comments__text', 'data-comment-text': '' }),
|
||||
el('p', { class: 'comments__value', 'data-comment-value': '' })
|
||||
])
|
||||
])),
|
||||
// Time left until the next comment; decorative, the counter carries the information.
|
||||
items.length < 2 ? null : el('div', { class: 'comments__progress', 'data-comment-progress': '', 'aria-hidden': 'true' }, [
|
||||
el('div', { class: 'comments__progress-fill' })
|
||||
|
||||
Reference in new issue
Block a user