-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tooltip appearance for long names in ConversationList #8605
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ | |
--> | ||
|
||
<template> | ||
<NcListItem :title="item.displayName" | ||
<NcListItem ref="listItem" | ||
:title="item.displayName" | ||
:class="{'unread-mention-conversation': item.unreadMention}" | ||
:anchor-id="`conversation_${item.token}`" | ||
:actions-aria-label="t('spreed', 'Conversation actions')" | ||
|
@@ -302,6 +303,23 @@ export default { | |
} | ||
}, | ||
}, | ||
|
||
// TODO: move the implementation to @nextcloud-vue/NcListItem | ||
watch: { | ||
'item.displayName': { | ||
immediate: true, | ||
handler(value) { | ||
this.$nextTick().then(() => { | ||
const titleSpan = this.$refs.listItem?.$el?.querySelector('.line-one__title') | ||
|
||
Comment on lines
+313
to
+314
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If But if
|
||
if (titleSpan && titleSpan.offsetWidth < titleSpan.scrollWidth) { | ||
titleSpan.setAttribute('title', value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All this just to set the title attribute? It would be a minor change in the nextcloud-vue lib to add this there without the need for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I know, it is not possible to detect if a text fit container or not without putting it in the container and looking at the result in DOM. watch + DOM access could be missed only if a title is always shown independently from title length. But a change in nextcloud-vue may help to avoid manual mutating of Vue-rendered DOM. |
||
} | ||
}) | ||
}, | ||
}, | ||
}, | ||
|
||
methods: { | ||
async copyLinkToConversation() { | ||
try { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for discussion of nextcloud-libraries/nextcloud-vue#3687, if the same approach could be implemented there