InfoPanel: make snippets keyboard-navigable and autoselected

Code snippets can now be navigated to be keyboard. Additionally,
focusing this way or by single-clicking will select the entire snippet
contents by default, then after a 50ms delay, allow for normal text
selection. This is a better experience for copying, especially on
mobile.
This commit is contained in:
rektdeckard
2020-08-17 13:06:05 -04:00
parent 16bfd4cdf8
commit 1d2bacd899
2 changed files with 21 additions and 2 deletions

View File

@@ -87,10 +87,27 @@
.snippet {
margin-bottom: 24px;
}
.snippet pre {
text-overflow: ellipsis;
color: black;
user-select: all;
-moz-user-select: all;
-webkit-user-select: all;
}
.snippet pre:focus {
animation: select 50ms step-end forwards;
}
@keyframes select {
to {
user-select: text;
-moz-user-select: text;
-webkit-user-select: text;
}
}
.snippet button {
background-color: transparent;
margin: 0;