Skip to content
Merged
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
9 changes: 7 additions & 2 deletions themes/beaver/assets/css/single-post.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
height: 100%;
}

.text-decoration-none {
text-decoration: none !important;
.heading-component .heading-self-link {
text-decoration: none;
color: #1a8cff;
visibility: hidden;
}
.heading-component:hover>.heading-self-link {
visibility: visible;
Comment on lines +37 to +38

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance user experience with transitions and mobile support.

The hover functionality works well for desktop, but consider these improvements:

  1. Add smooth transitions
  2. Support for touch devices

Consider applying these enhancements:

 .heading-component .heading-self-link {
   text-decoration: none;
   color: #1a8cff;
-  visibility: hidden;
+  opacity: 0;
+  transition: opacity 0.2s ease-in-out;
 }

 .heading-component:hover>.heading-self-link {
-  visibility: visible;
+  opacity: 1;
 }

+/* Show links permanently on touch devices */
+@media (hover: none) {
+  .heading-component .heading-self-link {
+    opacity: 1;
+  }
+}

Committable suggestion was skipped due to low confidence.

}
2 changes: 1 addition & 1 deletion themes/beaver/layouts/_default/_markup/render-heading.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}" class="text-decoration-none">#</a></h{{ .Level }}>
<h{{ .Level }} id="{{ .Anchor | safeURL }}" class="heading-component">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}" class="heading-self-link" aria-label="Link to {{ .Text }}" title="Link to this section">#</a></h{{ .Level }}>