Browse Source

Add description on hover in media gallery (#10713)

ThibG 5 months ago
parent
commit
b40dfc124b

+ 2
- 1
app/javascript/mastodon/features/account_gallery/components/media_item.js View File

@@ -88,6 +88,7 @@ export default class MediaItem extends ImmutablePureComponent {
88 88
     const width  = `${Math.floor((displayWidth - 4) / 3) - 4}px`;
89 89
     const height = width;
90 90
     const status = attachment.get('status');
91
+    const title = status.get('spoiler_text') || attachment.get('description');
91 92
 
92 93
     let thumbnail = '';
93 94
 
@@ -133,7 +134,7 @@ export default class MediaItem extends ImmutablePureComponent {
133 134
 
134 135
     return (
135 136
       <div className='account-gallery__item' style={{ width, height }}>
136
-        <a className='media-gallery__item-thumbnail' href={status.get('url')} target='_blank' onClick={this.handleClick}>
137
+        <a className='media-gallery__item-thumbnail' href={status.get('url')} target='_blank' onClick={this.handleClick} title={title}>
137 138
           <canvas width={32} height={32} ref={this.setCanvasRef} className={classNames('media-gallery__preview', { 'media-gallery__preview--hidden': visible && loaded })} />
138 139
           {visible && thumbnail}
139 140
         </a>

Loading…
Cancel
Save