+
setActive(a => !a)} >
+
{options ? (
) : null}
+
+ {options.map((opt, i) => (
+
)
}
diff --git a/src/components/Title.css b/src/components/Title.css
index 5e749821..d789f69f 100644
--- a/src/components/Title.css
+++ b/src/components/Title.css
@@ -29,6 +29,15 @@
cursor: pointer;
}
+.title.accent.title-accent-link:focus-visible {
+ border: 1px solid #ffffff;
+}
+
+.title.accent.title-accent-link:focus-visible .arrow {
+ transform: translateY(.1rem) translateX(-.5rem);
+}
+
+
.title-accent.title-accent-link .arrow {
transition: transform 100ms ease-in-out;
transform: translateY(.1rem);
@@ -39,3 +48,5 @@
transform: translateY(.1rem) translateX(-.5rem);
}
+
+
diff --git a/src/components/Title.js b/src/components/Title.js
index b03f1aa8..19ecf844 100644
--- a/src/components/Title.js
+++ b/src/components/Title.js
@@ -14,16 +14,24 @@ export function Title(props) {
const accentLink = props.accentLink || "";
const accent = props.accent || "";
+
+ function handleAccentClick(){
+ if (accentLink.length > 0) {
+ history.push(`/${streamData.type}`);
+ resetStreamData();
+ }
+ }
+
+ function handleKeyPress(event){
+ if (event.code === 'Enter' || event.code === 'Space'){
+ handleAccentClick();
+ }
+ }
return (
{accent.length > 0 ? (
-
{
- if (accentLink.length > 0) {
- history.push(`/${streamData.type}`);
- resetStreamData();
- }
- }} className={`title-accent ${accentLink.length > 0 ? 'title-accent-link' : ''}`}>
+
0 ? 'title-accent-link' : ''}`} tabIndex={accentLink.length > 0 ? 0 : undefined} onKeyPress={handleKeyPress}>
{accentLink.length > 0 ? () : null}{accent}
) : null}
diff --git a/src/components/TypeSelector.css b/src/components/TypeSelector.css
index 2a3d0743..82ada085 100644
--- a/src/components/TypeSelector.css
+++ b/src/components/TypeSelector.css
@@ -39,6 +39,11 @@
color: var(--text-secondary);
}
+.typeSelector .choice:focus-visible {
+ border: 1px solid #fff;
+ color: var(--text-secondary);
+}
+
.typeSelector .choice.selected {
color: var(--text);
}
diff --git a/src/components/TypeSelector.js b/src/components/TypeSelector.js
index 2af819f4..3102c4d8 100644
--- a/src/components/TypeSelector.js
+++ b/src/components/TypeSelector.js
@@ -1,23 +1,36 @@
import React from 'react';
-import './TypeSelector.css'
+import './TypeSelector.css';
// setType: (txt: string) => void
// choices: { label: string, value: string }[]
// selected: string
export function TypeSelector({ setType, choices, selected, noWrap = false }) {
- const selectedIndex = choices.findIndex(v=>v.value===selected);
- const transformStyles = {
- opacity: selectedIndex!==-1?1:0,
- transform: `translateX(${selectedIndex!==-1?selectedIndex*7:0}rem)`
+ const selectedIndex = choices.findIndex(v => v.value === selected);
+ const transformStyles = {
+ opacity: selectedIndex !== -1 ? 1 : 0,
+ transform: `translateX(${selectedIndex !== -1 ? selectedIndex * 7 : 0}rem)`,
+ };
+
+ const handleKeyPress = choice => event => {
+ if (event.code === 'Enter' || event.code === 'Space') {
+ setType(choice);
}
- return (
-
- {choices.map(v=>(
-
setType(v.value)}>
- {v.label}
-
- ))}
-
+ };
+
+ return (
+
+ {choices.map(v => (
+
setType(v.value)}
+ onKeyPress={handleKeyPress(v.value)}
+ tabIndex={0}
+ >
+ {v.label}
- )
+ ))}
+
+
+ );
}
diff --git a/src/views/Search.css b/src/views/Search.css
index ca4f80e9..d3ce7d38 100644
--- a/src/views/Search.css
+++ b/src/views/Search.css
@@ -18,6 +18,11 @@
border-radius: 4px;
color: var(--text);
}
+
+.cardView nav span:focus-visible {
+ border: 1px solid #fff;
+}
+
.cardView nav span:not(.selected-link) {
cursor: pointer;
}
diff --git a/src/views/Search.js b/src/views/Search.js
index f79dc294..775de439 100644
--- a/src/views/Search.js
+++ b/src/views/Search.js
@@ -207,6 +207,12 @@ export function SearchView() {
return
}
+ const handleKeyPress = page => event => {
+ if (event.code === 'Enter' || event.code === 'Space'){
+ setPage(page);
+ }
+ }
+
return (
@@ -215,9 +221,9 @@ export function SearchView() {
{/* Nav */}