microblog.pub/app/templates
Jane 68884d9afa Use <details> element for sensitive text
The sensitive text feature was implemented with <label> and hidden
checkbox <input> elements. There were two issues with this
implementation:
1. The user couldn't navigate to the "show/hide more" button using
   keyboard.
2. The label indicates two actions at the same time ("show/hide more"),
   making it unclear what the function of the checkbox was and what the
   current show/collapse state was.

As it is generally preferrable to use built-in HTML elements for the
best semantic, this commit moves to use the <details> and <summary>
elements for the sensitive text feature. The browser will open/collapse
the content in <details> automatically when the user clicks on the
<summary>, and keyboard navigation support is built-in.

This commit also changes the button to display "show more" or "show
less" depending on the state for visual clarity. This button is hidden
from the accessibility tree using `aria-label="false"`, as the <details>
element already exposes its state to the tree and we want to avoid
duplicated information.

A few caveats:
* The "show/hide sensitive content" button for sensitive attachments
  hasn't been changed yet as I'd like to get more feedback about the new
  implementation.
* As the summary/content warning text itself is also part of the
  <summary> tag, the user can now also click on them to toggle the
  visibility of the sensitive text. This may not be desirable as the
  current interface does not make it clear that this could happen; the
  user may try to select some text from the summary and be surprised
  by the sensitive text being expanded. One way to improve this would
  be to add an event listener to the summary text and call
  `preventDefault`, but this would introduce JavaScript code.
2022-11-30 12:26:34 +01:00
..
admin_direct_messages.html Only display tiny actor icon for shares 2022-08-26 07:57:10 +02:00
admin_inbox.html Fix minor grammatical issues, mostly in docs 2022-09-16 08:52:43 +02:00
admin_new.html Fix URL generation when not at domain root 2022-11-04 19:22:30 +01:00
admin_outbox.html Fix/imprive Undo support 2022-09-29 08:41:24 +02:00
admin_profile.html Pagination for the admin profile page 2022-08-26 08:10:46 +02:00
admin_stream.html Admin templates tweak 2022-08-02 20:40:43 +02:00
articles.html No more inline CSS 2022-08-29 21:42:54 +02:00
custom_page.html Fix OG image URL 2022-11-09 09:29:25 +01:00
error.html Tweak CSS 2022-09-20 20:00:35 +02:00
followers.html Add robots meta tags on pages in robots.txt 2022-11-18 20:30:29 +01:00
following.html Add robots meta tags on pages in robots.txt 2022-11-18 20:30:29 +01:00
header.html Fix active URL in the navbar 2022-11-09 08:15:29 +01:00
index.html More mf2 improvements for shares/reposts 2022-11-27 16:29:49 +01:00
indieauth_flow.html No more inline CSS 2022-08-29 21:42:54 +02:00
layout.html Fix active URL in the navbar 2022-11-09 08:15:29 +01:00
login.html Add robots meta tags on pages in robots.txt 2022-11-18 20:30:29 +01:00
lookup.html Improve fetch 2022-09-12 08:04:16 +02:00
notifications.html Add a flag on new notifications 2022-11-20 10:13:17 +01:00
object.html Proper mf2 for replies 2022-11-20 11:12:34 +01:00
redirect_to_remote_instance.html Tweak remote instance redirection 2022-11-13 17:37:19 +01:00
remote_follow.html Add robots meta tags on pages in robots.txt 2022-11-18 20:30:29 +01:00
remote_interact.html Add robots meta tags on pages in robots.txt 2022-11-18 20:30:29 +01:00
utils.html Use <details> element for sensitive text 2022-11-30 12:26:34 +01:00