diff --git a/app/javascript/wardrobe-2020/WardrobePage/PosePicker.js b/app/javascript/wardrobe-2020/WardrobePage/PosePicker.js
index 05e6064c..db302d73 100644
--- a/app/javascript/wardrobe-2020/WardrobePage/PosePicker.js
+++ b/app/javascript/wardrobe-2020/WardrobePage/PosePicker.js
@@ -186,6 +186,11 @@ function PosePicker({
flexDirection={{ base: "column", md: "column-reverse" }}
paddingY="2"
gap="2"
+ // HACK: To only apply `initialFocusRef` to the selected input
+ // in the *active* tab, we just use `isLazy` to only *render*
+ // the active tab. We could also watch the tab state and set
+ // the ref accordingly!
+ isLazy
>
@@ -226,7 +231,10 @@ function PosePicker({
-
+
@@ -564,11 +572,13 @@ function PosePickerEmptyExplanation() {
);
}
-function StyleSelect({ altStyles }) {
+function StyleSelect({ altStyles, initialFocusRef }) {
const [selectedStyleId, setSelectedStyleId] = React.useState(null);
const defaultStyle = { id: null, adjectiveName: "Default" };
+ const styles = [defaultStyle, ...altStyles];
+
return (
-
- {altStyles.map((altStyle) => (
+ {styles.map((altStyle) => (
))}
);
}
-function StyleOption({ altStyle, checked, onChange }) {
+function StyleOption({ altStyle, checked, onChange, inputRef }) {
const theme = useTheme();
const selectedBorderColor = useColorModeValue(
theme.colors.green["600"],
@@ -622,6 +628,7 @@ function StyleOption({ altStyle, checked, onChange }) {
value={altStyle.id}
checked={checked}
onChange={(e) => onChange(altStyle.id)}
+ ref={inputRef}
/>