diff --git a/web/source/settings/components/status.tsx b/web/source/settings/components/status.tsx
index 04c5933d5..a5b85f214 100644
--- a/web/source/settings/components/status.tsx
+++ b/web/source/settings/components/status.tsx
@@ -17,10 +17,11 @@
along with this program. If not, see
.
*/
-import React, { useRef } from "react";
+import React, { useState } from "react";
import { useVerifyCredentialsQuery } from "../lib/query/login";
import { MediaAttachment, Status as StatusType } from "../lib/types/status";
import sanitize from "sanitize-html";
+import BlurhashCanvas from "./blurhash";
export function FakeStatus({ children }) {
const { data: account = {
@@ -122,26 +123,15 @@ function StatusBody({ status }: { status: StatusType }) {
content = sanitize(status.content);
}
- const detailsRef = useRef
(null);
- const detailsOnClick = () => {
- detailsRef.current?.click();
- };
-
- const summaryRef = useRef(null);
- const summaryOnClick = () => {
- summaryRef.current?.click();
- };
+ const [ detailsOpen, setDetailsOpen ] = useState(false);
return (
-
+
e.key === "Enter" && summaryOnClick()}
+ aria-label={detailsOpen ? "Hide content" : "Show content"}
+ onClick={(e) => {
+ e.preventDefault();
+ setDetailsOpen(!detailsOpen);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ setDetailsOpen(!detailsOpen);
+ }
+ }}
>
- Toggle content visibility
+ {detailsOpen ? "Hide content" : "Show content"}
(null);
- const detailsOnClick = () => {
- detailsRef.current?.click();
- };
-
- const summaryRef = useRef
(null);
- const summaryOnClick = () => {
- summaryRef.current?.click();
- };
-
+ const [ detailsOpen, setDetailsOpen ] = useState(false);
return (
-
-
+
+
e.key === "Enter" && summaryOnClick()}
+ onClick={(e) => {
+ e.preventDefault();
+ setDetailsOpen(!detailsOpen);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ setDetailsOpen(!detailsOpen);
+ }
+ }}
>
Show media
@@ -229,15 +229,27 @@ function StatusMediaEntry({ media }: { media: MediaAttachment }) {
className="eye button"
role="button"
tabIndex={0}
- aria-label="Toggle show media"
- onClick={detailsOnClick}
- onKeyDown={e => e.key === "Enter" && summaryOnClick()}
+ aria-label={detailsOpen ? "Hide media" : "Show media"}
+ onClick={(e) => {
+ e.preventDefault();
+ setDetailsOpen(!detailsOpen);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ setDetailsOpen(!detailsOpen);
+ }
+ }}
>
+
+
+
--
cgit v1.2.3