diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index b3dab37023..99590ab97f 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -1640,6 +1640,10 @@ }, async showAllMedia() { + if (this.panels && this.panels.length > 0) { + return; + } + // We fetch more documents than media as they don’t require to be loaded // into memory right away. Revisit this once we have infinite scrolling: const DEFAULT_MEDIA_FETCH_COUNT = 50; diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 375679f93d..7f697b2976 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -1203,7 +1203,7 @@ .module-message__send-message-button { @include button-reset; - width: 100%; + width: calc(100% + 24px); @include font-body-2-bold; @@ -1228,6 +1228,11 @@ background-color: $color-gray-75; border: 1px solid $color-gray-45; } + + &:focus, + &:hover { + box-shadow: 0px 0px 0px 2px $color-signal-blue; + } } .module-message__author-avatar { @@ -1776,10 +1781,16 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05', @include button-reset; width: 100%; + padding: 5px; display: flex; flex-direction: row; align-items: center; + + &:focus, + &:hover { + box-shadow: 0px 0px 0px 2px $color-signal-blue; + } } .module-embedded-contact--with-content-above { diff --git a/ts/components/conversation/EmbeddedContact.md b/ts/components/conversation/EmbeddedContact.md index c2cb3ceae8..5321b03317 100644 --- a/ts/components/conversation/EmbeddedContact.md +++ b/ts/components/conversation/EmbeddedContact.md @@ -30,6 +30,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -40,6 +41,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -50,6 +52,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -61,6 +64,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -96,6 +100,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -106,6 +111,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -113,10 +119,11 @@ const contact = { #### Really long data -``` +```jsx const contact = { name: { - displayName: 'Dr. First Middle Last Junior Senior and all that and a bag of chips', + displayName: + 'Dr. First Middle Last Junior Senior and all that and a bag of chips', }, number: [ { @@ -130,23 +137,27 @@ const contact = { }, }, }; - +
+ authorColor="green" + direction="incoming" + i18n={util.i18n} + timestamp={Date.now()} + contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} + />
- + console.log('selectMessage', args)} + />
; ``` @@ -182,6 +193,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -194,6 +206,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -206,6 +219,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -238,6 +252,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -248,6 +263,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -258,6 +274,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -269,6 +286,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -299,6 +317,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -309,6 +328,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -319,6 +339,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -330,6 +351,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -363,6 +385,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -373,6 +396,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -383,6 +407,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -394,6 +419,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -421,6 +447,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -431,6 +458,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -441,6 +469,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -452,6 +481,7 @@ const contact = { i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -469,6 +499,7 @@ const contact = {}; i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -479,6 +510,7 @@ const contact = {}; i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -489,6 +521,7 @@ const contact = {}; i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -500,6 +533,7 @@ const contact = {}; i18n={util.i18n} timestamp={Date.now()} contact={contact} + selectMessage={(...args) => console.log('selectMessage', args)} />
; @@ -550,6 +584,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -561,6 +596,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -571,6 +607,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -582,6 +619,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -593,6 +631,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithoutAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -605,6 +644,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithoutAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -616,6 +656,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithoutAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
@@ -628,6 +669,7 @@ const contactWithoutAccount = { i18n={util.i18n} timestamp={Date.now()} contact={contactWithoutAccount} + selectMessage={(...args) => console.log('selectMessage', args)} />
; diff --git a/ts/components/conversation/EmbeddedContact.tsx b/ts/components/conversation/EmbeddedContact.tsx index d391689193..adb6c51bb0 100644 --- a/ts/components/conversation/EmbeddedContact.tsx +++ b/ts/components/conversation/EmbeddedContact.tsx @@ -16,6 +16,7 @@ interface Props { isIncoming: boolean; withContentAbove: boolean; withContentBelow: boolean; + tabIndex: number; onClick?: () => void; } @@ -26,6 +27,7 @@ export class EmbeddedContact extends React.Component { i18n, isIncoming, onClick, + tabIndex, withContentAbove, withContentBelow, } = this.props; @@ -43,6 +45,18 @@ export class EmbeddedContact extends React.Component { ? 'module-embedded-contact--with-content-below' : null )} + onKeyDown={(event: React.KeyboardEvent) => { + if (event.key !== 'Enter' && event.key !== 'Space') { + return; + } + + if (onClick) { + event.stopPropagation(); + event.preventDefault(); + + onClick(); + } + }} onClick={(event: React.MouseEvent) => { if (onClick) { event.stopPropagation(); @@ -51,6 +65,7 @@ export class EmbeddedContact extends React.Component { onClick(); } }} + tabIndex={tabIndex} > {renderAvatar({ contact, i18n, size: 52, direction })}
diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index eeb95661c1..70f08b2a7a 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -738,6 +738,9 @@ export class Message extends React.PureComponent { conversationType === 'group' && direction === 'incoming'; const withContentBelow = withCaption || !collapseMetadata; + const otherContent = (contact && contact.signalAccount) || withCaption; + const tabIndex = otherContent ? 0 : -1; + return ( { }} withContentAbove={withContentAbove} withContentBelow={withContentBelow} + tabIndex={tabIndex} /> ); } @@ -1250,10 +1254,13 @@ export class Message extends React.PureComponent { ) => { const { attachments, + contact, displayTapToViewMessage, id, isTapToView, isTapToViewExpired, + openConversation, + showContactDetail, showVisualAttachment, } = this.props; const { imageBroken } = this.state; @@ -1321,6 +1328,20 @@ export class Message extends React.PureComponent { this.audioRef.current.pause(); } } + + if (contact && contact.signalAccount) { + openConversation(contact.signalAccount); + + event.preventDefault(); + event.stopPropagation(); + } + + if (contact) { + showContactDetail({ contact, signalAccount: contact.signalAccount }); + + event.preventDefault(); + event.stopPropagation(); + } }; public openGenericAttachment = (event?: React.MouseEvent) => {