diff options
| author | Haishan <[email protected]> | 2020-02-06 16:59:25 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2020-02-10 17:20:15 +0800 |
| commit | 5e3cffcdefbe0072f7717268f31d9f769ce04eb3 (patch) | |
| tree | 1d1dd344383ba3844d539de7fb4110027d4d9520 /src/components | |
| parent | 804517c5106f5009b9197a434554edb058bffa68 (diff) | |
chore: add title to proxy dot in collapsed provider to increase a11y
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Proxy.js | 9 | ||||
| -rw-r--r-- | src/components/Root.js | 2 |
2 files changed, 10 insertions, 1 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 }} /> diff --git a/src/components/Root.js b/src/components/Root.js index 7303ee7..90b548e 100644 --- a/src/components/Root.js +++ b/src/components/Root.js @@ -49,7 +49,7 @@ const Root = () => ( <Router> <div className={s0.app}> <APIDiscovery /> - <Route path="/" element={<SideBar />} /> + <SideBar /> <div className={s0.content}> <Suspense fallback={<Loading2 />}> <Routes> |
