UX: prevent title edit icon from wrapping onto its own line (#36709)

This prevents the edit icon from wrapping onto its own line, which is
extra bothersome on desktop because it's invisible until hover! I've
removed the whitespace from the template between the icon and title, and
added a new span, which has `white-space: nowrap;`

Before:
<img width="700" alt="image"
src="https://github.com/user-attachments/assets/212a2262-a281-45d8-8ad5-6103e4e73f1c"
/>

(on hover)
<img width="700" height="326" alt="image"
src="https://github.com/user-attachments/assets/17fff736-923c-4a44-b561-36f6e5804d69"
/>



After (pencil will always wrap with the last word): 
<img width="700" alt="image"
src="https://github.com/user-attachments/assets/2690c1f6-7262-4189-bf34-49407f78b5d9"
/>
<img width="700" alt="image"
src="https://github.com/user-attachments/assets/ae2c4aca-f39c-4e2a-8612-9cc22f697dbc"
/>
This commit is contained in:
Kris
2025-12-15 18:41:56 -05:00
committed by GitHub
parent c4d4ed890f
commit 21a628ac06
2 changed files with 12 additions and 9 deletions
@@ -197,10 +197,12 @@
width: 100%;
}
.fancy-title {
.d-icon-pencil {
font-size: var(--font-down-3);
}
.edit-topic__wrapper {
// managing whitespace to prevent the edit icon from wrapping to a new line
white-space: nowrap;
font-size: var(--font-down-3);
vertical-align: 0.125em;
margin-left: var(--space-1);
}
html.discourse-no-touch & {
+6 -5
View File
@@ -234,11 +234,12 @@ export default <template>
{{on "click" @controller.handleTitleClick}}
class="fancy-title"
>
{{htmlSafe @controller.model.fancyTitle}}
{{#if @controller.model.details.can_edit}}
{{icon "pencil" class="edit-topic"}}
{{/if}}
{{htmlSafe @controller.model.fancyTitle~}}
{{~#if @controller.model.details.can_edit~}}
<span class="edit-topic__wrapper">
{{icon "pencil" class="edit-topic"}}
</span>
{{~/if}}
</a>
{{/if}}