misc a11y fixes
both pages pass Lighthouse now, yay!
This commit is contained in:
parent
3f379a819f
commit
8e6c9a3d98
3 changed files with 42 additions and 29 deletions
|
@ -81,7 +81,13 @@ function StartOutfitForm() {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Box width="4" />
|
<Box width="4" />
|
||||||
<Button type="submit" variantColor="green" disabled={!isValid}>
|
<Button
|
||||||
|
type="submit"
|
||||||
|
variantColor="green"
|
||||||
|
disabled={!isValid}
|
||||||
|
backgroundColor="green.600" // for AA contrast
|
||||||
|
_hover={{ backgroundColor: "green.700" }}
|
||||||
|
>
|
||||||
Start
|
Start
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -158,6 +164,7 @@ function SubmitPetForm() {
|
||||||
onChange={(e) => setPetName(e.target.value)}
|
onChange={(e) => setPetName(e.target.value)}
|
||||||
isDisabled={loading}
|
isDisabled={loading}
|
||||||
placeholder="Enter a pet's name"
|
placeholder="Enter a pet's name"
|
||||||
|
aria-label="Enter a pet's name"
|
||||||
borderColor="green.600"
|
borderColor="green.600"
|
||||||
_hover={{ borderColor: "green.400" }}
|
_hover={{ borderColor: "green.400" }}
|
||||||
boxShadow="md"
|
boxShadow="md"
|
||||||
|
@ -174,6 +181,8 @@ function SubmitPetForm() {
|
||||||
variantColor="green"
|
variantColor="green"
|
||||||
isDisabled={!petName}
|
isDisabled={!petName}
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
|
backgroundColor="green.600" // for AA contrast
|
||||||
|
_hover={{ backgroundColor: "green.700" }}
|
||||||
>
|
>
|
||||||
Start
|
Start
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -143,7 +143,7 @@ function ItemThumbnail({ src, isWorn }) {
|
||||||
},
|
},
|
||||||
])}
|
])}
|
||||||
>
|
>
|
||||||
<Image src={src} />
|
<Image src={src} alt="" />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,33 +100,37 @@ function ItemZoneGroup({ zoneLabel, items, outfitState, dispatchToOutfit }) {
|
||||||
<Heading2 mx="1">{zoneLabel}</Heading2>
|
<Heading2 mx="1">{zoneLabel}</Heading2>
|
||||||
<ItemListContainer>
|
<ItemListContainer>
|
||||||
<TransitionGroup component={null}>
|
<TransitionGroup component={null}>
|
||||||
{items.map((item) => (
|
{items.map((item) => {
|
||||||
<CSSTransition key={item.id} {...fadeOutAndRollUpTransition}>
|
const itemNameId =
|
||||||
<label>
|
zoneLabel.replace(/ /g, "-") + `-item-${item.id}-name`;
|
||||||
<VisuallyHidden
|
return (
|
||||||
as="input"
|
<CSSTransition key={item.id} {...fadeOutAndRollUpTransition}>
|
||||||
type="radio"
|
<label>
|
||||||
aria-labelledby={`${zoneLabel}-item-${item.id}-name`}
|
<VisuallyHidden
|
||||||
name={zoneLabel}
|
as="input"
|
||||||
value={item.id}
|
type="radio"
|
||||||
checked={outfitState.wornItemIds.includes(item.id)}
|
aria-labelledby={itemNameId}
|
||||||
onChange={onChange}
|
name={zoneLabel}
|
||||||
onClick={onClick}
|
value={item.id}
|
||||||
onKeyUp={(e) => {
|
checked={outfitState.wornItemIds.includes(item.id)}
|
||||||
if (e.key === " ") {
|
onChange={onChange}
|
||||||
onClick(e);
|
onClick={onClick}
|
||||||
}
|
onKeyUp={(e) => {
|
||||||
}}
|
if (e.key === " ") {
|
||||||
/>
|
onClick(e);
|
||||||
<Item
|
}
|
||||||
item={item}
|
}}
|
||||||
itemNameId={`${zoneLabel}-item-${item.id}-name`}
|
/>
|
||||||
outfitState={outfitState}
|
<Item
|
||||||
dispatchToOutfit={dispatchToOutfit}
|
item={item}
|
||||||
/>
|
itemNameId={itemNameId}
|
||||||
</label>
|
outfitState={outfitState}
|
||||||
</CSSTransition>
|
dispatchToOutfit={dispatchToOutfit}
|
||||||
))}
|
/>
|
||||||
|
</label>
|
||||||
|
</CSSTransition>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</TransitionGroup>
|
</TransitionGroup>
|
||||||
</ItemListContainer>
|
</ItemListContainer>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
Loading…
Reference in a new issue