Skip to content

Commit

Permalink
feat: make excerpt content non-interactive (#7)
Browse files Browse the repository at this point in the history
* feat: make content non-interactive

Prevents link/image clicks on synopsis from taking you to their respective locations.

* feat: add fallback for `inert` attribute
  • Loading branch information
davwheat authored Oct 11, 2021
1 parent 5e7d152 commit fce0d96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/src/forum/addSummaryExcerpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function addSummaryExcerpt() {

if (excerptPost) {
const excerpt = (
<div>
<div inert>
{richExcerpt ? m.trust(truncate(excerptPost.contentHtml(), excerptLength)) : truncate(excerptPost.contentPlain(), excerptLength)}
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions resources/less/forum/extension.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
color: @muted-more-color;
display: block;

// Fallback for `inert` HTML attribute
// Prevents interactivity with items within the excerpt
pointer-events: none;

img {
max-width: 100%
}
Expand Down

0 comments on commit fce0d96

Please sign in to comment.