Skip to content

Commit

Permalink
Comments accessibility requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinrivero committed Sep 25, 2024
1 parent 5ddeb73 commit 97bc1c1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 24 deletions.
9 changes: 4 additions & 5 deletions libs/blocks/review/components/review/Comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,27 @@ function Comments({
}

const disabledElement = html`
<input disabled=${!hasComment} type="submit" value=${sendCtaText} />
<input ?disabled=${!hasComment} type="submit" value=${sendCtaText} />
`;

const charCountElement = html`
<span class="comment-counter">${charCount}/${maxLength}</span>
`;
return html`
<fieldset className=${commentsClass}>
<label htmlFor="rating-comments" />
<label htmlFor="rating-comments">${placeholderText}</label>
<textarea
id="rating-comments"
ref=${textArea}
cols="40"
maxlength=${maxLength}
name="rating-comments"
aria-label=${label}
placeholder=${placeholderText}
aria-label=${placeholderText}
onInput=${onCommentChange}
onFocus=${onFocus}
value=${comment}
onBlur=${onBlur}
/>
></textarea>
<div id="ctaCover" onClick=${onCtaCoverClick}>
${charCountElement}
</div>
Expand Down
55 changes: 36 additions & 19 deletions libs/blocks/review/review.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
/* stylelint-disable color-function-notation */
/* stylelint-disable keyframes-name-pattern */
/* stylelint-disable selector-id-pattern */
/* stylelint-disable selector-class-pattern */
/* stylelint-disable custom-property-pattern */
/* stylelint-disable property-no-vendor-prefix */
:root {
--ratingBgImage: url('./img/star-outline.svg');
--ratingActiveBgImage: url('./img/star-filled.svg');
--focusOutlineColor: #4e8af4;
--focusOutline: 2px solid var(--focusOutlineColor);
--commentBgColor: #ffffff;
--commentBgColor: #fff;
--sendEnabledColor: #505050;
--sendDisabledColor: #bcbcbc;
--sendHoverColor: hsl(0, 0%, 0%);
--sendHoverColor: hsl(0%, 0%, 0%);
--tooltipBackground: #747474;
--tooltipText: #ffffff;
--tooltipText: #fff;
--tooltipTransitionTime: 0.3s;
--tooltipZIndex: 50;
--ratingCommentsHeight: 58px;
--ratingCommentsHeight: 81px;
--ctaCommentHeight: 22px;
--commentFieldsHeight: calc(var(--ratingCommentsHeight) + var(--ctaCommentHeight));
}
Expand Down Expand Up @@ -113,6 +119,17 @@
display: block;
}

.hlx-Review-commentFields label {
position: absolute;
top: 0;
left: 9px;
font-size: 19px;
color: #767676;
pointer-events: none;
transition: all 0.2s ease;
font-style: italic;
}

.hlx-Review-commentFields input[type='submit'] {
position: absolute;
right: 17px;
Expand Down Expand Up @@ -154,7 +171,7 @@
height: var(--ratingCommentsHeight);
border: none;
outline: none;
padding: 6px 8px 0 8px;
padding: 29px 8px 0;
font-size: 16px;
font-style: italic;
box-sizing: border-box;
Expand All @@ -167,7 +184,7 @@
}

.hlx-Review-commentFields .comment-counter {
color: #d3d3d3;
color: #767676;
font-size: var(--type-body-xs-size);
}

Expand All @@ -182,19 +199,19 @@
display: block;
}

.hlx-ReviewStats-average,
.hlx-ReviewStats-separator:first-of-type,
.hlx-ReviewStats-outOf {
font-weight: 700;
}

.hlx-ReviewStats-outOf,
.hlx-ReviewStats-separator,
.hlx-ReviewStats-total,
.hlx-ReviewStats-vote {
margin-left: 3px;
}

.hlx-ReviewStats-average,
.hlx-ReviewStats-separator:first-of-type,
.hlx-ReviewStats-outOf {
font-weight: 700;
}

.hlx-submitResponse {
font-size: 24px;
text-align: center;
Expand All @@ -204,7 +221,7 @@
position: relative;
}

.tooltip:before {
.tooltip::before {
content: attr(data-tooltip);
position: absolute;
right: 50%;
Expand All @@ -225,22 +242,22 @@
visibility: hidden;
}

.tooltip:after {
.tooltip::after {
content: '';
top: 100%;
position: absolute;
margin: 12px 1px 0 1px;
margin: 12px 1px 0;
border: 5px solid var(--tooltipBackground);
border-color: transparent transparent var(--tooltipBackground);
opacity: 0;
transition: var(--tooltipTransitionTime);
visibility: hidden;
}

.tooltip.is-hovering:before,
.tooltip.is-hovering:after,
.tooltip.has-keyboard-focus:before,
.tooltip.has-keyboard-focus:after {
.tooltip.is-hovering::before,
.tooltip.is-hovering::after,
.tooltip.has-keyboard-focus::before,
.tooltip.has-keyboard-focus::after {
opacity: 1;
visibility: visible;
z-index: var(--tooltipZIndex);
Expand Down

0 comments on commit 97bc1c1

Please sign in to comment.