summaryrefslogtreecommitdiff
path: root/src/components/Proxy.js
diff options
context:
space:
mode:
authorHaishan <[email protected]>2020-02-06 16:59:25 +0800
committerHaishan <[email protected]>2020-02-10 17:20:15 +0800
commit5e3cffcdefbe0072f7717268f31d9f769ce04eb3 (patch)
tree1d1dd344383ba3844d539de7fb4110027d4d9520 /src/components/Proxy.js
parent804517c5106f5009b9197a434554edb058bffa68 (diff)
chore: add title to proxy dot in collapsed provider to increase a11y
Diffstat (limited to 'src/components/Proxy.js')
-rw-r--r--src/components/Proxy.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/components/Proxy.js b/src/components/Proxy.js
index 117ff76..0cedf12 100644
--- a/src/components/Proxy.js
+++ b/src/components/Proxy.js
@@ -1,3 +1,4 @@
+// vim: set ft=javascript.flow :
import React from 'react';
import cx from 'classnames';
@@ -57,8 +58,16 @@ type ProxyProps = {
function ProxySmallImpl({ now, name, proxy, latency }: ProxyProps) {
const color = useMemo(() => getLabelColor(latency), [latency]);
+ const title = useMemo(() => {
+ let ret = name;
+ if (latency && typeof latency.number === 'number') {
+ ret += ' ' + latency.number + ' ms';
+ }
+ return ret;
+ }, [name, latency]);
return (
<div
+ title={title}
className={cx(s0.proxySmall, { [s0.now]: now })}
style={{ backgroundColor: color }}
/>