Skip to content

Commit

Permalink
example site - add kb accessible abbr html element tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
andis-sprinkis committed Dec 3, 2023
1 parent b7761c4 commit 08228fa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion site/documents/index/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
--text-color-link: blue;
--text-color-link-active: red;
--text-color-link-visited: purple;
--border-radius-outline: 0.0125em;
--border-radius-pre: 0.185em;
--grid-gap: 1em;
--li-indent-width: clamp(1.35em, 1.45em, 7vw);
Expand All @@ -23,6 +24,10 @@
--thickness-underline: 0.05em;
--offset-underline: 0.175em;
--thickness-underline-hover: 0.1125em;
--bg-color-tooltip: var(--text-color);
--text-color-tooltip: var(--bg-color);
--padding-tooltip: 0.25em 0.5em;
--border-radius-tooltip: 0.5em;
color-scheme: light dark;
}

Expand Down Expand Up @@ -65,7 +70,7 @@ a {
color: var(--text-color-link);
text-decoration-thickness: var(--thickness-underline);
text-underline-offset: var(--offset-underline);
border-radius: 0.0125em;
border-radius: var(--border-radius-pre);
}

a:visited {
Expand Down Expand Up @@ -114,9 +119,25 @@ a[target='_blank']::after, a[href^='mailto:']::after, a[href^='tel:']::after {
}

abbr {
position: relative;
text-decoration-style: dotted;
text-decoration-thickness: var(--thickness-underline);
text-underline-offset: var(--offset-underline);
border-radius: var(--border-radius-pre);
}

abbr[title]:hover::after,
abbr[title]:focus::after {
position: absolute;
top: var(--line-height-em);
left: 0;
width: auto;
white-space: nowrap;
content: attr(title);
background-color: var(--bg-color-tooltip);
color: var(--text-color-tooltip);
border-radius: var(--border-radius-tooltip);
padding: var(--padding-tooltip);
}

body,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>Example nested page</h1>
<p>
Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur
mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia <abbr title="example of an abbreviation HTML tag">ABBR</abbr>. Reprehenderit nostrud nostrud ipsum Lorem
mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia <abbr title="example of an abbreviation HTML tag" tabindex="0">ABBR</abbr>. Reprehenderit nostrud nostrud ipsum Lorem
est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia.
</p>
<p><span class="nowrap">This sentence does not wrap.</span></p>
Expand Down

0 comments on commit 08228fa

Please sign in to comment.