From b3f2ab654e95325b556e0c93b41ea6e15e45fffe Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 4 Jan 2017 14:11:37 -0500 Subject: Made Edit Post Modal autocomplete always attach to the bottom of the textarea (#4956) --- webapp/components/channel_switch_modal.jsx | 2 +- webapp/components/edit_post_modal.jsx | 1 + webapp/components/textbox.jsx | 36 +++++++++++++++------------- webapp/sass/components/_modal.scss | 10 ++++---- webapp/sass/components/_suggestion-list.scss | 5 ++++ 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/webapp/components/channel_switch_modal.jsx b/webapp/components/channel_switch_modal.jsx index 674725d88..2f8595c78 100644 --- a/webapp/components/channel_switch_modal.jsx +++ b/webapp/components/channel_switch_modal.jsx @@ -126,7 +126,7 @@ export default class SwitchChannelModal extends React.Component { const message = this.state.error; return ( diff --git a/webapp/components/textbox.jsx b/webapp/components/textbox.jsx index af3a14683..a1c31d888 100644 --- a/webapp/components/textbox.jsx +++ b/webapp/components/textbox.jsx @@ -21,6 +21,24 @@ const PreReleaseFeatures = Constants.PRE_RELEASE_FEATURES; import React from 'react'; export default class Textbox extends React.Component { + static propTypes = { + id: React.PropTypes.string.isRequired, + channelId: React.PropTypes.string, + value: React.PropTypes.string.isRequired, + onChange: React.PropTypes.func.isRequired, + onKeyPress: React.PropTypes.func.isRequired, + createMessage: React.PropTypes.string.isRequired, + onKeyDown: React.PropTypes.func, + onBlur: React.PropTypes.func, + supportsCommands: React.PropTypes.bool.isRequired, + handlePostError: React.PropTypes.func, + suggestionListStyle: React.PropTypes.string + }; + + static defaultProps = { + supportsCommands: true + }; + constructor(props) { super(props); @@ -242,6 +260,7 @@ export default class Textbox extends React.Component { onHeightChange={this.handleHeightChange} style={{visibility: this.state.preview ? 'hidden' : 'visible'}} listComponent={SuggestionList} + listStyle={this.props.suggestionListStyle} providers={this.suggestionProviders} channelId={this.props.channelId} value={this.props.value} @@ -272,20 +291,3 @@ export default class Textbox extends React.Component { ); } } - -Textbox.defaultProps = { - supportsCommands: true -}; - -Textbox.propTypes = { - id: React.PropTypes.string.isRequired, - channelId: React.PropTypes.string, - value: React.PropTypes.string.isRequired, - onChange: React.PropTypes.func.isRequired, - onKeyPress: React.PropTypes.func.isRequired, - createMessage: React.PropTypes.string.isRequired, - onKeyDown: React.PropTypes.func, - onBlur: React.PropTypes.func, - supportsCommands: React.PropTypes.bool.isRequired, - handlePostError: React.PropTypes.func -}; diff --git a/webapp/sass/components/_modal.scss b/webapp/sass/components/_modal.scss index e23630c3b..f98d23341 100644 --- a/webapp/sass/components/_modal.scss +++ b/webapp/sass/components/_modal.scss @@ -24,10 +24,6 @@ min-height: 8em; } - .suggestion-list { - bottom: -149px; - } - .suggestion-list__content { max-height: 150px; } @@ -669,3 +665,9 @@ padding-left: 0; } } + +.channel-switch-modal { + .modal-body { + overflow: visible; + } +} diff --git a/webapp/sass/components/_suggestion-list.scss b/webapp/sass/components/_suggestion-list.scss index d4cd9ef05..91db7536c 100644 --- a/webapp/sass/components/_suggestion-list.scss +++ b/webapp/sass/components/_suggestion-list.scss @@ -11,6 +11,11 @@ bottom: 100%; } +.suggestion-list--bottom { + position: relative; + height: 0; +} + .suggestion-list__content { background-color: $white; border: $border-gray; -- cgit v1.2.3-1-g7c22