Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A11y/announce placeholders #1801

Merged
merged 6 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/stylesheets/index.css

Large diffs are not rendered by default.

116 changes: 83 additions & 33 deletions app/assets/stylesheets/tailwind/components/placeholder.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,37 @@
/*! purgecss start ignore */
.placeholder,
.placeholder-no-brackets,
.placeholder-conditional {
.placeholder-conditional .condition {
word-wrap: break-word;
border-radius: 20px;
box-shadow:
inset 0.47em 0 0 0 #fff,
inset -0.47em 0 0 0 #fff,
inset 0 -0.15em 0 0 #fff,
inset 0 0.15em 0 0 #fff;
inset 0.47em 0 0 0 var(--message-wrapper-bg, #fff),
inset var(--right-offset, -0.47em) 0 0 0 var(--message-wrapper-bg, #fff),
inset 0 -0.15em 0 0 var(--message-wrapper-bg, #fff),
inset 0 0.15em 0 0 var(--message-wrapper-bg, #fff);
@apply inline bg-yellow text-black break-words;
}
.sms-message-wrapper .placeholder,
.sms-message-wrapper .placeholder-no-brackets {
.sms-message-wrapper {
/* theme gray.button */
box-shadow:
inset 0.47em 0 0 0 #dee0e2,
inset -0.47em 0 0 0 #dee0e2,
inset 0 -0.18em 0 0 #dee0e2,
inset 0 0.18em 0 0 #dee0e2;
--message-wrapper-bg: #dee0e2;
}

.placeholder-no-brackets {
padding-left: 3px;
padding-right: 3px;
border-radius: 1px;
box-shadow:
inset 0 -0.1em 0 0 #fff,
inset 0 0.1em 0 0 #fff;
inset 0 -0.1em 0 0 var(--message-wrapper-bg, #fff),
inset 0 0.1em 0 0 var(--message-wrapper-bg, #fff);
}

.placeholder-conditional {
.placeholder-conditional .condition {
@apply rounded-none;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
box-shadow:
inset 0.47em 0 0 0 #fff,
inset -0.89em 0 0 0 #fff,
inset 0 -0.16em 0 0 #fff,
inset 0 0.16em 0 0 #fff;
}
.sms-message-wrapper .placeholder-conditional {
box-shadow:
inset 0.47em 0 0 0 #dee0e2,
inset -0.89em 0 0 0 #dee0e2,
inset 0 -0.18em 0 0 #dee0e2,
inset 0 0.18em 0 0 #dee0e2;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
--right-offset: -0.89em;
}

.placeholder-redacted {
Expand All @@ -57,18 +41,84 @@
opacity: 0.8;
top: 0.1em;
background-color: currentColor;
box-shadow: inset 0 -0.35em 0 0 #fff;
box-shadow: inset 0 -0.35em 0 0 var(--message-wrapper-bg, #fff);
@apply py-0 relative;
}
.sms-message-wrapper .placeholder-redacted {
box-shadow: inset 0 -0.35em 0 0 #dee0e2;
}

*:focus + p .sms-message-wrapper .placeholder-redacted {
/* theme yellow */
box-shadow: inset 0 -0.35em 0 0 #ffbf47;
}

/* Makes the content before and after MARK only audible to screen readers */
mark {
/* remove default styles for MARK element */
background: none;
}
mark::before,
mark::after,
mark .condition::before,
mark .condition::after {
clip-path: inset(100%);
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}

/* PLACEHOLDER TYPES */
[lang*="en"] mark.placeholder {
--name: "custom content";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase "custom content" confused me here. Why not call this "variable" or "variable content" instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked through the guidance and see that we do indeed call this "custom content" - but I still this think is a confusing way to refer to it. Maybe we should update the guidance? @YedidaZalik what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever we do update the guidance, we'll have other things to clean up within admin. I suggest we be consistent for now, and decide if we want to re-consider this term. We also have similar work planned in cds-snc/notification-planning#1350

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense to me!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 "custom content" was chosen by Yael a year or so ago

}
[lang*="en"] mark.placeholder-conditional {
--name: "filtered content";
}
[lang*="en"] mark.placeholder-redacted {
--name: "redacted content";
}

[lang="fr"] mark.placeholder {
--name: "contenu personnalisé";
}
[lang="fr"] mark.placeholder-conditional {
--name: "contenu filtré";
}
[lang="fr"] mark.placeholder-redacted {
--name: "contenu rédigé";
}

/* BEGINS or ENDS */
[lang*="en"] mark[class*="placeholder"]::before {
content: " [" var(--name) " begins] ";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of the square brackets here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe they ensure a short pause. Looking at this table, only Voiceover would pause. NVDA and JAWS would announce "brackets" twice.

JAWS always announces everything. Only pauses at commas, semicolons and ellipses

NVDA would pause with regular parenthesis ()

I don't mind using semicolons, nobody will see them!

}
[lang*="en"] mark[class*="placeholder"]::after {
content: " [" var(--name) " ends] ";
}

[lang="fr"] mark[class*="placeholder"]::before {
content: " [ début du " var(--name) "] ";
}
[lang="fr"] mark[class*="placeholder"]::after {
content: " [ fin du " var(--name) "] ";
}

/* IF...THEN */
[lang*="en"] mark.placeholder-conditional .condition::before {
content: " [if] ";
}
[lang*="en"] mark.placeholder-conditional .condition::after {
content: " [then] ";
}

[lang="fr"] mark.placeholder-conditional .condition::before {
content: " [si] ";
}
[lang="fr"] mark.placeholder-conditional .condition::after {
content: " [alors] ";
}

.autocomplete__input {
z-index: 5;
}
Expand Down
1 change: 1 addition & 0 deletions app/templates/views/templates/_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ <h2 class="heading-medium">{{ _('Ready to send?') }}</h2>
{{ template|string|translate_preview_template }}
</div>

<!-- <div id="placeholder_tag" role="tooltip" aria-hidden="true">Placeholder variable</div> -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Thanks


Loading