Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better accessibility #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/client/components/RoomSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ const RoomSelector = ({socket, joinRoom}) => {
<h1>Public rooms</h1>
<p>(click to join)</p>
<div className="room-list">
{rooms.map(room => <div key={room.id}>
<span onClick={room.id !== currentRoomId ? (() => {
{rooms.map((room, i) => <span key={room.id} tabIndex={i + 1} onClick={room.id !== currentRoomId ? (() => {
joinRoom(room.id);
setCurrentRoomId(null);
}) : () => null}>
{`${room.players}/${room.maxPlayers} ${room.name}${room.id === currentRoomId ? ' ◄' : ''}${!room.isPublic ? ' (private)' : ''}`}
</span>
</div>)}
</span>)}
</div>
</div>
{!currentRoomId ?
Expand Down
36 changes: 32 additions & 4 deletions src/client/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ body {
color: white;
font-family: sans-serif;
text-shadow: 0 0 2px aqua, 0 0 2px aqua, 0 0 2px aqua;
user-select: none;

button {
font-size: 1.5rem;
Expand All @@ -20,6 +21,16 @@ body {
text-shadow: 0 0 6px aqua, 0 0 6px aqua;
box-shadow: 0 0 6px 1px aqua, inset 0 0 6px 1px aqua;
cursor: pointer;
outline: none;

&:hover {
background-color: #121315;
}

&:active {
text-shadow: 0 0 2px aqua, 0 0 2px aqua;
box-shadow: 0 0 2px 1px aqua, inset 0 0 2px 1px aqua;
}
}
}

Expand Down Expand Up @@ -59,12 +70,21 @@ body {
input {
color: white;
background-color: transparent;
transition: 0.25s;

&:hover {
background-color: #121315;
}

&:focus {
outline: none;
box-shadow: 0 0 6px 2px aqua, inset 0 0 6px 2px aqua;
}

&:active {
box-shadow: none;
}

&[type=checkbox] {
vertical-align: middle;
}
Expand All @@ -76,17 +96,25 @@ input {
text-shadow: 0 0 6px aqua, 0 0 6px aqua;
}

input:placeholder-shown + button[type="submit"], button.disabled {
opacity: 0.3;
}

.room-list {
margin-top: 1rem;
display: flex;
flex-direction: column;

span {
cursor: pointer;
padding: 0.5rem;
border-radius: 0.5rem;
transition: 0.25s;

&:hover {
background-color: #121315;
}

&:active, &:focus {
outline: none;
box-shadow: 0 0 2px 1px aqua, inset 0 0 2px 1px aqua;
}
}
}

Expand Down