From 19bb3bc994c2fa9a22338ed7fc2962e1b84cdc19 Mon Sep 17 00:00:00 2001
From: Josh Perez <60019601+josh-signal@users.noreply.github.com>
Date: Thu, 7 Apr 2022 17:11:33 -0400
Subject: [PATCH] Adds keyboard affordance to story viewer
---
stylesheets/components/StoryListItem.scss | 6 +
stylesheets/components/StoryViewer.scss | 11 +
ts/components/StoriesPane.tsx | 90 ++++---
ts/components/StoryListItem.tsx | 1 +
ts/components/StoryViewer.tsx | 312 +++++++++++-----------
5 files changed, 224 insertions(+), 196 deletions(-)
diff --git a/stylesheets/components/StoryListItem.scss b/stylesheets/components/StoryListItem.scss
index baef66b982a2..8ab16e23c667 100644
--- a/stylesheets/components/StoryListItem.scss
+++ b/stylesheets/components/StoryListItem.scss
@@ -10,6 +10,12 @@
height: 96px;
width: 100%;
+ @include keyboard-mode {
+ &:focus {
+ background: $color-gray-65;
+ }
+ }
+
&:hover {
background: $color-gray-65;
}
diff --git a/stylesheets/components/StoryViewer.scss b/stylesheets/components/StoryViewer.scss
index 36d6006df3a8..53d945e6f6b6 100644
--- a/stylesheets/components/StoryViewer.scss
+++ b/stylesheets/components/StoryViewer.scss
@@ -40,6 +40,12 @@
width: 24px;
@include color-svg('../images/icons/v2/more-horiz-24.svg', $color-white);
+
+ @include keyboard-mode {
+ &:focus {
+ background-color: $color-ultramarine;
+ }
+ }
}
&__container {
@@ -89,6 +95,11 @@
&__reply {
@include button-reset;
+ @include keyboard-mode {
+ &:focus {
+ color: $color-ultramarine;
+ }
+ }
}
&__progress {
diff --git a/ts/components/StoriesPane.tsx b/ts/components/StoriesPane.tsx
index 9ef59635fc8c..e510338ff1e3 100644
--- a/ts/components/StoriesPane.tsx
+++ b/ts/components/StoriesPane.tsx
@@ -1,6 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
+import FocusTrap from 'focus-trap-react';
import Fuse from 'fuse.js';
import React, { useEffect, useState } from 'react';
import classNames from 'classnames';
@@ -82,51 +83,54 @@ export const StoriesPane = ({
}, [searchTerm, stories]);
return (
- <>
-
-